Is it possible to open a folder by using Boost (I'm looking for a Windows, Linux, and Mac solution)?
If not, please tell me something other than the system()
, as its use may cause an antivirus warning.
PS: I tried various ways and all failed. The closest one gave me an "Access denied" error.
CodePudding user response:
The answer to this is always going to be platform-specific.
On Windows, ShellExecute
can do it:
ShellExecuteW (nullptr, L"explore", L"x:/full/path/to/folder/", nullptr, nullptr, SW_SHOWNORMAL);
On macOS, you have to drop down to Objective-C (or Swift, I suppose) and call upon the services provided by NSWorkspace
.
That's rather too much ground to cover in detail here, but you'd do something like this:
[[NSWorkspace sharedWorkspace] selectFile: @"/full/path/to/ =folder" inFileViewerRootedAtPath: @""];
For Linux, I don't know, sorry, but it's very likely going to depend on what desktop you're running.
CodePudding user response:
No, this is not the way. Maybe it is somehow possible, but you'd be going in the wrong direction. It would be much easier and more secure to just write your own file selection UI.