Gin
|
Copies files, creating folders where required requesting admin access only if required. More...
Public Types | |
enum | Result { success , failed , cancelled , nopermissions } |
Public Member Functions | |
void | createDir (const juce::File &dir) |
Add a directory to create. More... | |
void | copyFile (const juce::File &src, const juce::File &dst) |
Add a file to copy. More... | |
void | moveFile (const juce::File &src, const juce::File &dst) |
Add a file to move. More... | |
void | deleteFile (const juce::File &f) |
Delete a file or directory. More... | |
Result | execute (bool launchSelf=false) |
Perform the copy. More... | |
void | clear () |
Clear all files to be copied. More... | |
Static Public Member Functions | |
static bool | processCommandLine (juce::String commandLine) |
Call from JUCEApplication::initialise() and abort the initialise process if returns true. More... | |
static Result | runScriptWithAdminAccess (juce::File script, bool launchSelf) |
Run a script as root. More... | |
Copies files, creating folders where required requesting admin access only if required.
void ElevatedFileCopy::createDir | ( | const juce::File & | dir | ) |
Add a directory to create.
void ElevatedFileCopy::copyFile | ( | const juce::File & | src, |
const juce::File & | dst | ||
) |
Add a file to copy.
src and dst must be complete file names, neither can be a directory
void ElevatedFileCopy::moveFile | ( | const juce::File & | src, |
const juce::File & | dst | ||
) |
Add a file to move.
src and dst must be complete file names, neither can be a directory
void ElevatedFileCopy::deleteFile | ( | const juce::File & | f | ) |
Delete a file or directory.
Result ElevatedFileCopy::execute | ( | bool | launchSelf = false | ) |
Perform the copy.
If launchSelf is false, then on Windows cmd.exe will be executed with admin permissions to copy the files. This looks odd to the user since Windows Command Processor will ask for permissions to make changes rather than your app. Pass true to make your app get launched with admin permissions instead. In this case, you must call processCommandLine from yours apps initialise instead, and if it returns true, return from initialise asap and your app will quit as it's just a temporary process.
void ElevatedFileCopy::clear | ( | ) |
Clear all files to be copied.
|
static |
Call from JUCEApplication::initialise() and abort the initialise process if returns true.
|
static |
Run a script as root.
See execute for the meaning of launch self