[platform] setting CWD in macOS launcher started via open command (IDEA-196722; TBX-3314)

GitOrigin-RevId: d8f424c6b12f804f7bf228193b01f1595f200aa9
This commit is contained in:
Roman Shevchenko
2020-01-28 23:04:56 +00:00
committed by intellij-monorepo-bot
parent 95e839c394
commit 3a48ccf804
2 changed files with 8 additions and 9 deletions
+8 -9
View File
@@ -464,17 +464,16 @@ NSString *getOverridePropertiesPath() {
}
- (void)process_cwd {
NSDictionary *jvmInfo = [[NSBundle mainBundle] objectForInfoDictionaryKey:JVMOptions];
NSString *cwd = [jvmInfo objectForKey:@"WorkingDirectory"];
if (cwd != nil && cwd != NULL) {
cwd = [self expandMacros:cwd];
if (chdir([cwd UTF8String]) != 0) {
NSLog(@"Cannot chdir to working directory at %@", cwd);
const char *cmd = getenv("_");
if (cmd != NULL && strcmp(cmd, "/usr/bin/open") == 0) {
const char *pwd = getenv("PWD");
if (pwd != NULL && chdir(pwd) != 0) {
NSLog(@"Cannot chdir() to %s", pwd);
}
} else {
NSString *dir = [[NSFileManager defaultManager] currentDirectoryPath];
NSLog(@"WorkingDirectory is absent in Info.plist. Current Directory: %@", dir);
}
NSString *dir = [[NSFileManager defaultManager] currentDirectoryPath];
NSLog(@"Current Directory: %@", dir);
}
BOOL validationJavaVersion(){