I have this code that is using FileChooser to save a (audio) file. It works fine in windows, macOS and Linux, but not in Android (and iOS):
File fileToSave = lastRecording;
lastRecording = File(); // "Close" fille
juce::File initialFilAndDirectory;
initialFilAndDirectory =
File::getSpecialLocation
(
File::userMusicDirectory
).getChildFile
(
fileToSave.getFileName()
);
myChooser =
std::make_unique <FileChooser>
(
"Save Audio File as..."
,
initialFilAndDirectory
,
"*.wav"
);
myChooser->launchAsync
(
FileBrowserComponent::saveMode
|
FileBrowserComponent::canSelectFiles
|
FileBrowserComponent::warnAboutOverwriting
,
[fileToSave](const FileChooser& chooser)
{
auto rslt = chooser.getResult();
if (rslt == File{})
return;
File soundFile(rslt);
fileToSave.moveFileTo(soundFile);
}
);
On Android (and iOS) the file is created fine with
myChooser->launchAsync
but when the
fileToSave.moveFileTo(soundFile);
is run it returns false at
#if ! NAMES_ARE_CASE_SENSITIVE
if (*this != newFile)
#endif
if (! newFile.deleteFile())
return false;
and if I run
soundFile.hasWriteAccess();
it always returns false
How can I solve that problem ?
–
Eigil