As we mentioned earlier the decision was taken to deprecate the Utility function, but we still needed to provide the equivalent functionality by some other means. The obvious candidate to update here was the existing SYSTEM object, but rather than overloading it with a whole raft of new members, all of which were filing-system related, we took the decision to create a new object instead, and thus the FILESYSTEM object was born.
The FILESYSTEM object, like the SYSTEM one, is managed internally by the Presentation Server and simply exposes some common Windows Shell directory and file-based functionality to Basic+. As you’ll see below there are some new properties and methods that were not part of the old Utility function, but we’ve also taken the opportunity to enhance some of the existing methods as well – they now hook into the Windows API SHFileOperation function thereby offering better system integration, such as using standard Windows copy/move dialogs and exposing “Undo” functionality.
Here’s a summary of the FILESYSTEM object interface that you’ll find in the new version:
Properties
Property | Dev | Run | Get | Set | Description |
CURRENTDIR | X | X | X | Provides access to the current working directory. | |
DRIVELIST | X | X | Returns a dynamic array of attached drive letters. | ||
FILEOPRESULT | X | X | Returns the most recent result code from a FILESYSTEM object method call. | ||
SYSTEMDIR | X | X | Returns the OS System directory. | ||
TEMPDIR | X | X | Returns the user’s Temp directory. | ||
WINDOWSDIR | X | X | Returns the Windows directory. |
Methods
Method | Description |
COPYDIR | Copies an entire directory and sub-directories to a new location. |
COPYFILES | Copies one or more files to a new location. |
DELETEFILES | Deletes one or more files. |
DIREXISTS | Checks to see if a directory exists. |
FILEEXISTS | Checks to see if a file exists. |
GETABSOLUTEPATH | Returns an absolute path from a relative path |
GETLONGPATH | Converts a short path to its long path form |
GETRELATIVEPATH | Returns a relative path from an absolute path |
GETSHORTPATH | Converts a long path to its short path (i.e. MS-DOS “8.3”) form |
GETSPECIALDIR | Returns the path to a “special” OS folder such as “My Documents”, AppData and so on. |
MAKEDIR | Creates a directory or nested directory path. |
MOVEDIR | Moves an entire directory and sub-directories to a new location. |
MOVEFILES | Moves one or more files to a new location. |
REMOVEDIR | Removes a directory. |
RENAMEDIR | Renames a directory. |
RENAMEFILE | Renames a file. |
Of course this is probably not a final list, so please feel free to leave us a comment if you think of anything that would make a good addition here.