src/jdk.jpackage/macosx/native/libapplauncher/MacPlatform.mm
author herrick
Wed, 28 Aug 2019 11:30:40 -0400
branchJDK-8200758-branch
changeset 57909 c7de06ed4b54
parent 57531 d24019d561da
child 58455 0d95b41d0895
permissions -rw-r--r--
8229979: jpackage cleanup src files, help text, and javadoc Reviewed-by: asemenyuk, kcr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
     1
/*
57106
ea870b9ce89a 8216492: Update copyright of all new jpackage fils to 2019
kcr
parents: 57099
diff changeset
     2
 * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
     4
 *
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    10
 *
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    15
 * accompanied this code).
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    16
 *
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    20
 *
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    23
 * questions.
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    24
 */
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    25
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    26
#include "Platform.h"
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    27
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    28
#include "MacPlatform.h"
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    29
#include "Helpers.h"
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    30
#include "Package.h"
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    31
#include "PropertyFile.h"
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    32
#include "IniFile.h"
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    33
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    34
#include <sys/sysctl.h>
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    35
#include <pthread.h>
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    36
#include <vector>
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    37
#include <signal.h>
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    38
#include <mach-o/dyld.h>
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    39
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    40
#import <Foundation/Foundation.h>
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    41
#import <AppKit/NSRunningApplication.h>
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    42
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    43
#include <CoreFoundation/CoreFoundation.h>
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    44
#include <CoreFoundation/CFString.h>
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    45
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    46
#ifdef __OBJC__
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    47
#import <Cocoa/Cocoa.h>
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    48
#endif //__OBJC__
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    49
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    50
#define MAC_JPACKAGE_TMP_DIR \
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    51
        "/Library/Application Support/Java/JPackage/tmp"
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    52
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    53
NSString* StringToNSString(TString Value) {
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    54
    NSString* result = [NSString stringWithCString : Value.c_str()
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    55
            encoding : [NSString defaultCStringEncoding]];
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    56
    return result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    57
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    58
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    59
FileSystemStringToString::FileSystemStringToString(const TCHAR* value) {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    60
    bool release = false;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    61
    PlatformString lvalue = PlatformString(value);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    62
    Platform& platform = Platform::GetInstance();
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    63
    TCHAR* buffer = platform.ConvertFileSystemStringToString(lvalue, release);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    64
    FData = buffer;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    65
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    66
    if (buffer != NULL && release == true) {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    67
        delete[] buffer;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    68
    }
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    69
}
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    70
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    71
FileSystemStringToString::operator TString() {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    72
    return FData;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    73
}
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    74
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    75
StringToFileSystemString::StringToFileSystemString(const TString &value) {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    76
    FRelease = false;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    77
    PlatformString lvalue = PlatformString(value);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    78
    Platform& platform = Platform::GetInstance();
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    79
    FData = platform.ConvertStringToFileSystemString(lvalue, FRelease);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    80
}
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    81
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    82
StringToFileSystemString::~StringToFileSystemString() {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    83
    if (FRelease == true) {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    84
        delete[] FData;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    85
    }
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    86
}
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    87
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    88
StringToFileSystemString::operator TCHAR* () {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    89
    return FData;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    90
}
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    91
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    92
MacPlatform::MacPlatform(void) : Platform(), PosixPlatform() {
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    93
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    94
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    95
MacPlatform::~MacPlatform(void) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    96
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
    97
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    98
TString MacPlatform::GetPackageAppDirectory() {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
    99
    return FilePath::IncludeTrailingSeparator(
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   100
            GetPackageRootDirectory()) + _T("Java");
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   101
}
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   102
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   103
TString MacPlatform::GetPackageLauncherDirectory() {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   104
    return FilePath::IncludeTrailingSeparator(
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   105
            GetPackageRootDirectory()) + _T("MacOS");
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   106
}
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   107
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   108
TString MacPlatform::GetPackageRuntimeBinDirectory() {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   109
    return FilePath::IncludeTrailingSeparator(GetPackageRootDirectory()) +
57333
77109ab87402 8219683: Modify App Image layout on Mac
herrick
parents: 57323
diff changeset
   110
            _T("runtime/Contents/Home/bin");
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   111
}
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   112
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   113
bool MacPlatform::UsePListForConfigFile() {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   114
    return FilePath::FileExists(GetConfigFileName()) == false;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   115
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   116
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   117
void MacPlatform::ShowMessage(TString Title, TString Description) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   118
    NSString *ltitle = StringToNSString(Title);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   119
    NSString *ldescription = StringToNSString(Description);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   120
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   121
    NSLog(@"%@:%@", ltitle, ldescription);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   122
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   123
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   124
void MacPlatform::ShowMessage(TString Description) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   125
    TString appname = GetModuleFileName();
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   126
    appname = FilePath::ExtractFileName(appname);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   127
    ShowMessage(appname, Description);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   128
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   129
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   130
TString MacPlatform::getTmpDirString() {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   131
    return TString(MAC_JPACKAGE_TMP_DIR);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   132
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   133
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   134
TCHAR* MacPlatform::ConvertStringToFileSystemString(TCHAR* Source,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   135
        bool &release) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   136
    TCHAR* result = NULL;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   137
    release = false;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   138
    CFStringRef StringRef = CFStringCreateWithCString(kCFAllocatorDefault,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   139
            Source, kCFStringEncodingUTF8);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   140
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   141
    if (StringRef != NULL) {
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   142
        @ try {
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   143
            CFIndex length =
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   144
                    CFStringGetMaximumSizeOfFileSystemRepresentation(StringRef);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   145
            result = new char[length + 1];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   146
            if (result != NULL) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   147
                if (CFStringGetFileSystemRepresentation(StringRef,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   148
                        result, length)) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   149
                    release = true;
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   150
                } else {
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   151
                    delete[] result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   152
                    result = NULL;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   153
                }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   154
            }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   155
        }
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   156
        @finally
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   157
        {
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   158
            CFRelease(StringRef);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   159
        }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   160
    }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   161
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   162
    return result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   163
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   164
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   165
TCHAR* MacPlatform::ConvertFileSystemStringToString(TCHAR* Source,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   166
        bool &release) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   167
    TCHAR* result = NULL;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   168
    release = false;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   169
    CFStringRef StringRef = CFStringCreateWithFileSystemRepresentation(
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   170
            kCFAllocatorDefault, Source);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   171
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   172
    if (StringRef != NULL) {
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   173
        @ try {
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   174
            CFIndex length = CFStringGetLength(StringRef);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   175
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   176
            if (length > 0) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   177
                CFIndex maxSize = CFStringGetMaximumSizeForEncoding(
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   178
                        length, kCFStringEncodingUTF8);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   179
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   180
                result = new char[maxSize + 1];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   181
                if (result != NULL) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   182
                    if (CFStringGetCString(StringRef, result, maxSize,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   183
                            kCFStringEncodingUTF8) == true) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   184
                        release = true;
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   185
                    } else {
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   186
                        delete[] result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   187
                        result = NULL;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   188
                    }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   189
                }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   190
            }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   191
        }
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   192
        @finally
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   193
        {
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   194
            CFRelease(StringRef);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   195
        }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   196
    }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   197
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   198
    return result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   199
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   200
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   201
TString MacPlatform::GetPackageRootDirectory() {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   202
    NSBundle *mainBundle = [NSBundle mainBundle];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   203
    NSString *mainBundlePath = [mainBundle bundlePath];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   204
    NSString *contentsPath =
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   205
            [mainBundlePath stringByAppendingString : @"/Contents"];
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   206
    TString result = [contentsPath UTF8String];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   207
    return result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   208
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   209
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   210
TString MacPlatform::GetAppDataDirectory() {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   211
    TString result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   212
    NSArray *paths = NSSearchPathForDirectoriesInDomains(
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   213
            NSApplicationSupportDirectory, NSUserDomainMask, YES);
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   214
    NSString *applicationSupportDirectory = [paths firstObject];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   215
    result = [applicationSupportDirectory UTF8String];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   216
    return result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   217
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   218
57316
2891b3ae222d 8221641: Follow up code clean up for JDK-8221582
herrick
parents: 57291
diff changeset
   219
TString MacPlatform::GetBundledJavaLibraryFileName(TString RuntimePath) {
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   220
    TString result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   221
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   222
    // first try lib/, then lib/jli
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   223
    result = FilePath::IncludeTrailingSeparator(RuntimePath) +
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   224
            _T("Contents/Home/lib/libjli.dylib");
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   225
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   226
    if (FilePath::FileExists(result) == false) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   227
        result = FilePath::IncludeTrailingSeparator(RuntimePath) +
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   228
                _T("Contents/Home/lib/jli/libjli.dylib");
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   229
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   230
        if (FilePath::FileExists(result) == false) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   231
            // cannot find
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   232
            NSLog(@"Cannot find libjli.dysym!");
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   233
            result = _T("");
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   234
        }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   235
    }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   236
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   237
    return result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   238
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   239
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   240
TString MacPlatform::GetAppName() {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   241
    NSString *appName = [[NSProcessInfo processInfo] processName];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   242
    TString result = [appName UTF8String];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   243
    return result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   244
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   245
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   246
void PosixProcess::Cleanup() {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   247
    if (FOutputHandle != 0) {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   248
        close(FOutputHandle);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   249
        FOutputHandle = 0;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   250
    }
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   251
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   252
    if (FInputHandle != 0) {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   253
        close(FInputHandle);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   254
        FInputHandle = 0;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   255
    }
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   256
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   257
    sigaction(SIGINT, &savintr, (struct sigaction *) 0);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   258
    sigaction(SIGQUIT, &savequit, (struct sigaction *) 0);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   259
    sigprocmask(SIG_SETMASK, &saveblock, (sigset_t *) 0);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   260
}
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   261
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   262
#define PIPE_READ 0
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   263
#define PIPE_WRITE 1
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   264
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   265
bool PosixProcess::Execute(const TString Application,
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   266
        const std::vector<TString> Arguments, bool AWait) {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   267
    bool result = false;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   268
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   269
    if (FRunning == false) {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   270
        FRunning = true;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   271
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   272
        int handles[2];
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   273
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   274
        if (pipe(handles) == -1) {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   275
            return false;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   276
        }
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   277
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   278
        struct sigaction sa;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   279
        sa.sa_handler = SIG_IGN;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   280
        sigemptyset(&sa.sa_mask);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   281
        sa.sa_flags = 0;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   282
        sigemptyset(&savintr.sa_mask);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   283
        sigemptyset(&savequit.sa_mask);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   284
        sigaction(SIGINT, &sa, &savintr);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   285
        sigaction(SIGQUIT, &sa, &savequit);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   286
        sigaddset(&sa.sa_mask, SIGCHLD);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   287
        sigprocmask(SIG_BLOCK, &sa.sa_mask, &saveblock);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   288
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   289
        FChildPID = fork();
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   290
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   291
        // PID returned by vfork is 0 for the child process and the
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   292
        // PID of the child process for the parent.
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   293
        if (FChildPID == -1) {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   294
            // Error
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   295
            TString message = PlatformString::Format(
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   296
                    _T("Error: Unable to create process %s"),
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   297
                    Application.data());
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   298
            throw Exception(message);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   299
        } else if (FChildPID == 0) {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   300
            Cleanup();
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   301
            TString command = Application;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   302
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   303
            for (std::vector<TString>::const_iterator iterator =
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   304
                    Arguments.begin(); iterator != Arguments.end();
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   305
                    iterator++) {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   306
                command += TString(_T(" ")) + *iterator;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   307
            }
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   308
#ifdef DEBUG
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   309
            printf("%s\n", command.data());
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   310
#endif // DEBUG
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   311
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   312
            dup2(handles[PIPE_READ], STDIN_FILENO);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   313
            dup2(handles[PIPE_WRITE], STDOUT_FILENO);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   314
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   315
            close(handles[PIPE_READ]);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   316
            close(handles[PIPE_WRITE]);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   317
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   318
            execl("/bin/sh", "sh", "-c", command.data(), (char *) 0);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   319
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   320
            _exit(127);
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   321
        } else {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   322
            FOutputHandle = handles[PIPE_READ];
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   323
            FInputHandle = handles[PIPE_WRITE];
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   324
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   325
            if (AWait == true) {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   326
                ReadOutput();
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   327
                Wait();
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   328
                Cleanup();
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   329
                FRunning = false;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   330
                result = true;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   331
            } else {
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   332
                result = true;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   333
            }
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   334
        }
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   335
    }
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   336
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   337
    return result;
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   338
}
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   339
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   340
void AppendPListArrayToIniFile(NSDictionary *infoDictionary,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   341
        IniFile *result, TString Section) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   342
    NSString *sectionKey =
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   343
            [NSString stringWithUTF8String : PlatformString(Section).toMultibyte()];
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   344
    NSDictionary *array = [infoDictionary objectForKey : sectionKey];
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   345
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   346
    for (id option in array) {
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   347
        if ([option isKindOfClass : [NSString class]]) {
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   348
            TString arg = [option UTF8String];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   349
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   350
            TString name;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   351
            TString value;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   352
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   353
            if (Helpers::SplitOptionIntoNameValue(arg, name, value) == true) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   354
                result->Append(Section, name, value);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   355
            }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   356
        }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   357
    }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   358
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   359
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   360
void AppendPListDictionaryToIniFile(NSDictionary *infoDictionary,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   361
        IniFile *result, TString Section, bool FollowSection = true) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   362
    NSDictionary *dictionary = NULL;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   363
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   364
    if (FollowSection == true) {
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   365
        NSString *sectionKey = [NSString stringWithUTF8String : PlatformString(
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   366
                Section).toMultibyte()];
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   367
        dictionary = [infoDictionary objectForKey : sectionKey];
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   368
    } else {
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   369
        dictionary = infoDictionary;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   370
    }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   371
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   372
    for (id key in dictionary) {
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   373
        id option = [dictionary valueForKey : key];
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   374
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   375
        if ([key isKindOfClass : [NSString class]] &&
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   376
                [option isKindOfClass : [NSString class]]) {
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   377
            TString name = [key UTF8String];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   378
            TString value = [option UTF8String];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   379
            result->Append(Section, name, value);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   380
        }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   381
    }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   382
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   383
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   384
// Convert parts of the info.plist to the INI format the rest of the jpackage
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   385
// uses unless a jpackage config file exists.
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   386
ISectionalPropertyContainer* MacPlatform::GetConfigFile(TString FileName) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   387
    IniFile* result = new IniFile();
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   388
    if (result == NULL) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   389
        return NULL;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   390
    }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   391
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   392
    if (UsePListForConfigFile() == false) {
57323
66c1dbc008c5 8217895: jpackage --identifer purpose
herrick
parents: 57316
diff changeset
   393
        result->LoadFromFile(FileName);
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   394
    } else {
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   395
        NSBundle *mainBundle = [NSBundle mainBundle];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   396
        NSDictionary *infoDictionary = [mainBundle infoDictionary];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   397
        std::map<TString, TString> keys = GetKeys();
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   398
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   399
        // JPackage options.
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   400
        AppendPListDictionaryToIniFile(infoDictionary, result,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   401
                keys[CONFIG_SECTION_APPLICATION], false);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   402
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   403
        // jvmargs
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   404
        AppendPListArrayToIniFile(infoDictionary, result,
57291
f2d429260ad4 8221582: Rename jvm-args option to java-options
herrick
parents: 57194
diff changeset
   405
                keys[CONFIG_SECTION_JAVAOPTIONS]);
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   406
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   407
        // Generate AppCDS Cache
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   408
        AppendPListDictionaryToIniFile(infoDictionary, result,
57291
f2d429260ad4 8221582: Rename jvm-args option to java-options
herrick
parents: 57194
diff changeset
   409
                keys[CONFIG_SECTION_APPCDSJAVAOPTIONS]);
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   410
        AppendPListDictionaryToIniFile(infoDictionary, result,
57291
f2d429260ad4 8221582: Rename jvm-args option to java-options
herrick
parents: 57194
diff changeset
   411
                keys[CONFIG_SECTION_APPCDSGENERATECACHEJAVAOPTIONS]);
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   412
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   413
        // args
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   414
        AppendPListArrayToIniFile(infoDictionary, result,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   415
                keys[CONFIG_SECTION_ARGOPTIONS]);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   416
    }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   417
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   418
    return result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   419
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   420
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   421
TString GetModuleFileNameOSX() {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   422
    Dl_info module_info;
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   423
    if (dladdr(reinterpret_cast<void*> (GetModuleFileNameOSX),
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   424
            &module_info) == 0) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   425
        // Failed to find the symbol we asked for.
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   426
        return std::string();
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   427
    }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   428
    return TString(module_info.dli_fname);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   429
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   430
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   431
TString MacPlatform::GetModuleFileName() {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   432
    TString result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   433
    DynamicBuffer<TCHAR> buffer(MAX_PATH);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   434
    uint32_t size = buffer.GetSize();
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   435
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   436
    if (_NSGetExecutablePath(buffer.GetData(), &size) == 0) {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   437
        result = FileSystemStringToString(buffer.GetData());
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   438
    }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   439
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   440
    return result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   441
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   442
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   443
bool MacPlatform::IsMainThread() {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   444
    bool result = (pthread_main_np() == 1);
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   445
    return result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   446
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   447
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   448
TPlatformNumber MacPlatform::GetMemorySize() {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   449
    unsigned long long memory = [[NSProcessInfo processInfo] physicalMemory];
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   450
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   451
    // Convert from bytes to megabytes.
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   452
    TPlatformNumber result = memory / 1048576;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   453
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   454
    return result;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   455
}
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   456
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   457
std::map<TString, TString> MacPlatform::GetKeys() {
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   458
    std::map<TString, TString> keys;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   459
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   460
    if (UsePListForConfigFile() == false) {
57194
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   461
        return Platform::GetKeys();
9d5fccd97421 8212091: Move jpackage native code under platform specific folders and files
herrick
parents: 57106
diff changeset
   462
    } else {
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   463
        keys.insert(std::map<TString, TString>::value_type(CONFIG_VERSION,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   464
                _T("app.version")));
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   465
        keys.insert(std::map<TString, TString>::value_type(CONFIG_MAINJAR_KEY,
57316
2891b3ae222d 8221641: Follow up code clean up for JDK-8221582
herrick
parents: 57291
diff changeset
   466
                _T("JavaMainJarName")));
57909
c7de06ed4b54 8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents: 57531
diff changeset
   467
        keys.insert(std::map<TString,
c7de06ed4b54 8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents: 57531
diff changeset
   468
                TString>::value_type(CONFIG_MAINMODULE_KEY,
57316
2891b3ae222d 8221641: Follow up code clean up for JDK-8221582
herrick
parents: 57291
diff changeset
   469
                _T("JavaMainModuleName")));
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   470
        keys.insert(std::map<TString, TString>::value_type(
57316
2891b3ae222d 8221641: Follow up code clean up for JDK-8221582
herrick
parents: 57291
diff changeset
   471
                CONFIG_MAINCLASSNAME_KEY, _T("JavaMainClassName")));
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   472
        keys.insert(std::map<TString, TString>::value_type(
57316
2891b3ae222d 8221641: Follow up code clean up for JDK-8221582
herrick
parents: 57291
diff changeset
   473
                CONFIG_CLASSPATH_KEY, _T("JavaAppClasspath")));
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   474
        keys.insert(std::map<TString, TString>::value_type(APP_NAME_KEY,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   475
                _T("CFBundleName")));
57316
2891b3ae222d 8221641: Follow up code clean up for JDK-8221582
herrick
parents: 57291
diff changeset
   476
        keys.insert(std::map<TString, TString>::value_type(JAVA_RUNTIME_KEY,
2891b3ae222d 8221641: Follow up code clean up for JDK-8221582
herrick
parents: 57291
diff changeset
   477
                _T("JavaRuntime")));
57909
c7de06ed4b54 8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents: 57531
diff changeset
   478
        keys.insert(std::map<TString,
c7de06ed4b54 8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents: 57531
diff changeset
   479
                TString>::value_type(JPACKAGE_APP_DATA_DIR,
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   480
                _T("CFBundleIdentifier")));
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   481
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   482
        keys.insert(std::map<TString, TString>::value_type(CONFIG_SPLASH_KEY,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   483
                _T("app.splash")));
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   484
        keys.insert(std::map<TString, TString>::value_type(CONFIG_APP_MEMORY,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   485
                _T("app.memory")));
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   486
        keys.insert(std::map<TString, TString>::value_type(CONFIG_APP_DEBUG,
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   487
                _T("app.debug")));
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   488
        keys.insert(std::map<TString, TString>::value_type(
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   489
                CONFIG_APPLICATION_INSTANCE, _T("app.application.instance")));
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   490
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   491
        keys.insert(std::map<TString, TString>::value_type(
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   492
                CONFIG_SECTION_APPLICATION, _T("Application")));
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   493
        keys.insert(std::map<TString, TString>::value_type(
57291
f2d429260ad4 8221582: Rename jvm-args option to java-options
herrick
parents: 57194
diff changeset
   494
                CONFIG_SECTION_JAVAOPTIONS, _T("JavaOptions")));
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   495
        keys.insert(std::map<TString, TString>::value_type(
57291
f2d429260ad4 8221582: Rename jvm-args option to java-options
herrick
parents: 57194
diff changeset
   496
                CONFIG_SECTION_APPCDSJAVAOPTIONS, _T("AppCDSJavaOptions")));
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   497
        keys.insert(std::map<TString, TString>::value_type(
57291
f2d429260ad4 8221582: Rename jvm-args option to java-options
herrick
parents: 57194
diff changeset
   498
                CONFIG_SECTION_APPCDSGENERATECACHEJAVAOPTIONS,
f2d429260ad4 8221582: Rename jvm-args option to java-options
herrick
parents: 57194
diff changeset
   499
                _T("AppCDSGenerateCacheJavaOptions")));
57064
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   500
        keys.insert(std::map<TString, TString>::value_type(
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   501
                CONFIG_SECTION_ARGOPTIONS, _T("ArgOptions")));
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   502
    }
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   503
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   504
    return keys;
a7fdadf67a92 8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff changeset
   505
}