How to resolve the algorithm Make directory path step by step in the FutureBasic programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Make directory path step by step in the FutureBasic programming language
Table of Contents
Problem Statement
Create a directory and any missing parents. This task is named after the posix mkdir -p command, and several libraries which implement the same behavior. Please implement a function of a single path string (for example ./path/to/dir) which has the above side-effect. If the directory already exists, return successfully. Ideally implementations will work equally well cross-platform (on windows, linux, and OS X). It's likely that your language implements such a function as part of its standard library. If so, please also show how such a function would be implemented.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Make directory path step by step in the FutureBasic programming language
Source code in the futurebasic programming language
void local fn MakeDirectoryPath
CFStringRef path = fn StringByExpandingTildeInPath( @"~/Desktop/FirstDir/SecondDir" )
fn FileManagerCreateDirectoryAtURL( fn URLFileURLWithPath(path), YES, NULL )
end fn
fn MakeDirectoryPath
HandleEvents
void local fn MakeDirectoryPath
Str255 cmd
cmd = "mkdir -p " + fn StringPascalString( fn StringByExpandingTildeInPath( @"~/Desktop/FirstDir/SecondDir" ) )
open "UNIX", 2, cmd
end fn
fn MakeDirectoryPath
HandleEvents
void local fn MakeDirectoryPath
TaskRef task = fn TaskInit
TaskSetExecutableURL( task, fn URLFileURLWithPath( @"bin/mkdir" ) )
TaskSetArguments( task, @[@"-p",fn StringByExpandingTildeInPath( @"~/Desktop/FirstDir/SecondDir" )] )
fn TaskLaunch( task, NULL )
end fn
fn MakeDirectoryPath
HandleEvents
You may also check:How to resolve the algorithm Pascal's triangle/Puzzle step by step in the REXX programming language
You may also check:How to resolve the algorithm Hilbert curve step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm 99 bottles of beer step by step in the EMal programming language
You may also check:How to resolve the algorithm Rock-paper-scissors step by step in the Fortran programming language
You may also check:How to resolve the algorithm User input/Text step by step in the TI-89 BASIC programming language