I’m trying to use ChildProcess to run CHMOD so I can give write-access to my DATA folder. Is this the only way to do it? So far if I create a SH file with what I need and call from ChildProcess it works. But I would like to have a more direct method of doing that if possible.
If I try to just pass all the parameters instead I get just the output of the parameters and no changes to the folder I’m trying to mess with.
Hi WilliamK surprised to see you are still here, lol, I bought you’d be a retired rich man by now.
According to other users, it won’t be possible to use this mechanism on Catalina, because it now requires an admin password for file access, so the shell just hangs waiting for the user’s admin password. Are they wrong? If you have a workaround that would be very good news.
:-p Nah, still working hard.
Oh Apple, always making shit… no idea indeed. Will see if I find something. I did manage to call the .sh script but it does nothing.
Turns out it was the writeString that got my all wrong. As it adds some extra chars at the end which makes the SH no longer runs… I used writeText (the correct one) and now it works. Oh boy… I’m getting old… Thanks again guys. Will post the code once is all done.
Here we go.
AskPassword("Sets the Wusik Engine Data folder as read/write.", thePassword);
File runScript = File::addTrailingSeparator(File::getSpecialLocation(File::SpecialLocationType::commonDocumentsDirectory).getFullPathName()) + "wusikperm.sh";
ScopedPointer<OutputStream> fstream = runScript.createOutputStream();
fstream->writeText("echo '" + thePassword + "' | sudo -S chmod -R 777 '" + getEffect()->dataFiles->dataFilesLocation + "'", false, false, "");
fstream = nullptr;
String xError = xProc2.readAllProcessOutput();
xError = runWPProcess.readAllProcessOutput();