Deletes a file. Returns true on a successful deletion.
the path to the file in the Drafts area to be deleted.
// Example
let fmCloud = FileManager.createCloud();
fmCloud.TA_delete("/Library/Scripts/old_file.txt");
Load the content for the current draft from the file path specified for it in the meta data file.
For the current draft, the file path would be stored as draft.meta.filePath
, and this is saved to a
meta data file in iCloud, with the UUID of the draft being the key for its set of meta data.
A valid path must be specified for the draft prior to running this function.
It will replace all existing content in the draft. No warning is provided, but it will force a version save prior to loading.
Returns true
if the file saved successfully, and false
if it did not.
// Example
let fmCloud = FileManager.createCloud();
fmCloud.TA_fileMetaLoad();
Set the file path for the current draft in the meta data file.
For the current draft, the file path would be stored as draft.meta.filePath
, and this is saved to a
meta data file in iCloud, with the UUID of the draft being the key for its set of meta data.
The user must manually enter the iCloud file path with the root (/
) starting at the Drafts root folder.
The path should also include the file extension. It will attempt to load the file path for the draft to allow for editing,
but if no path is specified, it will simply default to the root folder and the file path should be added.
Returns the specified file path.
// Example
let fmCloud = FileManager.createCloud();
fmCloud.TA_fileMetaPath();
Save the current draft to the file path specified for it in the meta data file.
For the current draft, the file path would be stored as draft.meta.filePath
, and this is saved to a
meta data file in iCloud, with the UUID of the draft being the key for its set of meta data.
A valid path must be specified for the draft prior to running this function.
Returns true
if the file saved successfully, and false
if it did not.
// Example
let fmCloud = FileManager.createCloud();
fmCloud.TA_fileMetaSave();
List files in a directory matching a regular expression. The regular expression is matched against the file name, with the function returning an array of matching file paths. The file path to search is relative to the Drafts directory (local or cloud, as specified by the FileManager creation);
the file path in the Drafts directory to be listed for matching files.
the regular expression (including forward slashes and modifiers) to be used in matching the file name.
// Example
let fmCloud = FileManager.createCloud();
// Files with a ".txt" file extension
alert(fmCloud.TA_listFilesRegex("/L", /\.txt$/).join("\n"));
Snapshot a file by duplicating it in the same folder, but prefixing the file name with a time stamp. Returns true the successful creation of the file.
the path to the file in the Drafts area to be snapshotted.
// Example
let fmCloud = FileManager.createCloud();
fmCloud.TA_snapshot("/Library/some_file.txt");
FileManager (Drafts)
The ThoughtAsylum library includes a set of extensions to the FileManager object