showInFileManager

This commit is contained in:
Vadim Lopatin 2016-01-25 14:25:15 +03:00
parent 82e8004757
commit 7eee173a55
1 changed files with 21 additions and 0 deletions

View File

@ -1165,6 +1165,27 @@ class SDLPlatform : Platform {
string s = toUTF8(text);
SDL_SetClipboardText(s.toStringz);
}
/// show directory or file in OS file manager (explorer, finder, etc...)
override bool showInFileManager(string pathName) {
import std.process;
string normalized = buildNormalizedPath(pathName);
version (OSX) {
string exe = "/usr/bin/osascript";
string[] args;
args ~= "-e";
args ~= "tell application \"Finder\" to reveal POSIX file \" ~ normalized ~ \"";
auto pid = spawnProcess(exe, args, Config.none);
wait(pid);
args[1] = "tell application \"Finder\" to activate";
pid = spawnProcess(exe, args, Config.none);
wait(pid);
return true;
} else {
// TODO: implement for POSIX
}
return false;
}
}
version (Windows) {