Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added File.isOnHardDisk script wrapper #687

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions hi_scripting/scripting/api/ScriptingApiObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ struct ScriptingObjects::ScriptFile::Wrapper
API_METHOD_WRAPPER_1(ScriptFile, loadEncryptedObject);
API_METHOD_WRAPPER_0(ScriptFile, getRedirectedFolder);
API_METHOD_WRAPPER_1(ScriptFile, rename);
API_METHOD_WRAPPER_0(ScriptFile, isOnHardDisk);
API_METHOD_WRAPPER_1(ScriptFile, move);
API_METHOD_WRAPPER_1(ScriptFile, copy);
API_METHOD_WRAPPER_1(ScriptFile, copyDirectory);
Expand Down Expand Up @@ -280,6 +281,7 @@ ScriptingObjects::ScriptFile::ScriptFile(ProcessorWithScriptingContent* p, const
ADD_API_METHOD_0(loadAudioMetadata);
ADD_API_METHOD_0(loadAsBase64String);
ADD_API_METHOD_1(rename);
ADD_API_METHOD_0(isOnHardDisk);
ADD_API_METHOD_1(move);
ADD_API_METHOD_1(copy);
ADD_API_METHOD_1(copyDirectory);
Expand Down Expand Up @@ -783,6 +785,11 @@ bool ScriptingObjects::ScriptFile::rename(String newName)
return f.moveFileTo(newFile);
}

bool ScriptingObjects::ScriptFile::isOnHardDisk()
{
return f.isOnHardDisk();
}

bool ScriptingObjects::ScriptFile::move(var target)
{
if (auto sf = dynamic_cast<ScriptFile*>(target.getObject()))
Expand Down
3 changes: 3 additions & 0 deletions hi_scripting/scripting/api/ScriptingApiObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ namespace ScriptingObjects

/** Renames the file. */
bool rename(String newName);

/** True if this file is on a hard disk. This will fail if it's a network drive, but will still be true for removable hard-disks. */
bool isOnHardDisk();

/** Moves the file. The target isn't the directory to put it in, it's the actual file to create. */
bool move(var target);
Expand Down