Suppose you create a document in 4D and you want to place it somewhere on disk. You would have to know exactly where you want to store the document and also know that this location exists. Or, you can create the path to the location you want to place the document.
The following method, called PreparePath, does exactly that:
` prepare the paths. For windows, we need to go passed the drive specifier
` if the path does not end with the directory glyph or separator, we add it
` find the next folder in the directory tree
` create the folder if it does not exist
:(Test path name($createPath)<0)
:(Test path name($createPath)=1)
If you called the following method and passed a long path name as in:
PreparePath("C:\\Top Folder\\Middle Folder\\Bottom Folder\\")
It would create those three folders in the C: drive. With this method, you would not have to worry about testing for a location since this method not only tests, but creates the location for you.
Note: If you try creating a path which is actually a path to a file, then the method will not do anything.