• R/O
  • HTTP
  • SSH
  • HTTPS

CharacterManaJ: Commit

キャラクターなんとかJの本体


Commit MetaInfo

Revisionad2eb0523ad33fa6a2ed79739ed94dca5f264359 (tree)
Time2019-01-14 15:48:19
Authorseraphy <seraphy@user...>
Commiterseraphy

Log Message

Macの起動時のjvm_options設定で現在のバンドルのパスを示す$APP_ROOTをサポート

Change Summary

Incremental Difference

--- a/pom.xml
+++ b/pom.xml
@@ -333,6 +333,10 @@
333333 <include name="README_mac.txt"/>
334334 </fileset>
335335 </copy>
336+ <chmod dir="${project.build.directory}/appbundle/CharacterManaJ.app/Contents/Characters"
337+ perm="g+srw" type="dir"/>
338+ <chmod dir="${project.build.directory}/appbundle/CharacterManaJ.app/Contents/Characters"
339+ perm="g+rw" includes="**/*" type="file"/>
336340
337341 <delete file="${project.build.directory}/${project.artifactId}_${project.version}.dmg"/>
338342 <exec executable="hdiutil">
--- a/src/JavaLaunch/JavaLaunch/main.m
+++ b/src/JavaLaunch/JavaLaunch/main.m
@@ -12,6 +12,8 @@
1212 #define JAVA_LAUNCH_ERROR "JavaLaunchError"
1313 #define UNSPECIFIED_ERROR "An unknown error occurred."
1414
15+#define APP_ROOT_PREFIX "$APP_ROOT"
16+
1517 NSString *FindJavaHome() {
1618 NSTask *task = [[NSTask alloc] init];
1719 NSPipe *pipe = [NSPipe pipe];
@@ -87,18 +89,20 @@ int main(int argc, const char * argv[]) {
8789 NSLog(@"displayAppName=%@", displayAppName);
8890 printf("%s\n", [displayAppName UTF8String]);
8991
90- //
91- NSMutableArray *jvmOptions = [[[mainBundle infoDictionary] objectForKey:@"JVMOptions"] mutableCopy];
92- if (jvmOptions == nil) {
93- jvmOptions = [NSMutableArray array];
92+ // JVMオプションの取得
93+ NSMutableArray *jvmOptions = [NSMutableArray array];
94+ NSArray *jvmOptionsFixed = [[mainBundle infoDictionary] objectForKey:@"JVMOptions"];
95+ if (jvmOptionsFixed != nil) {
96+ for (NSString *option in jvmOptionsFixed) {
97+ NSString *jvmOption = [option stringByReplacingOccurrencesOfString:@APP_ROOT_PREFIX withString:[mainBundle bundlePath]]; // $APP_ROOTという文字列をバンドルパスに置換する
98+ [jvmOptions addObject: jvmOption];
99+ }
94100 }
95-
96- // バンドル名
97- NSString *bundleName = [[mainBundle infoDictionary] objectForKey:@"CFBundleName"];
98- NSLog(@"bundleName=%@", bundleName);
99-
101+
100102 // ユーザー定義オプションの読み込み
103+ NSString *bundleName = [[mainBundle infoDictionary] objectForKey:@"CFBundleName"];
101104 NSString *userJvmOptionPath = [NSHomeDirectory() stringByAppendingPathComponent: [NSString stringWithFormat:@"/Library/%@/jvm_options", bundleName]];
105+ NSLog(@"use define jvmoptions path=%@", userJvmOptionPath);
102106 if ([fileManager fileExistsAtPath: userJvmOptionPath]) {
103107 NSString* fileContents = [NSString stringWithContentsOfFile:userJvmOptionPath
104108 encoding:NSUTF8StringEncoding error:nil];
@@ -108,7 +112,8 @@ int main(int argc, const char * argv[]) {
108112 for (id line in allLinedStrings) {
109113 NSString *option = [line stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
110114 if (![option hasPrefix:@"#"] && [option length] > 0) {
111- NSLog(@"option: %@", line);
115+ option = [option stringByReplacingOccurrencesOfString:@APP_ROOT_PREFIX withString:[mainBundle bundlePath]];
116+ NSLog(@"option: %@", option);
112117 [jvmOptions addObject: option];
113118 }
114119 }
--- /dev/null
+++ b/src/main/attachment/bundle/CharacterManaJ.app/Contents/Characters/appConfig.xml
@@ -0,0 +1,3 @@
1+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
2+<properties version="1.0">
3+</properties>
--- a/src/main/attachment/bundle/CharacterManaJ.app/Contents/Info.plist
+++ b/src/main/attachment/bundle/CharacterManaJ.app/Contents/Info.plist
@@ -1,36 +1,44 @@
11 <?xml version="1.0" encoding="UTF-8"?>
22 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33 <plist version="1.0">
4- <dict>
5- <key>CFBundleDevelopmentRegion</key>
6- <string>English</string>
7- <key>CFBundleExecutable</key>
8- <string>JavaLaunch</string>
9- <key>CFBundleIconFile</key>
10- <string>icon.icns</string>
11- <key>CFBundleIdentifier</key>
12- <string>charactermanaj.CharacterManaJ</string>
13- <key>CFBundleDisplayName</key>
14- <string>CharacterManaJ</string>
15- <key>CFBundleInfoDictionaryVersion</key>
16- <string>6.0</string>
17- <key>CFBundleName</key>
18- <string>CharacterManaJ</string>
19- <key>CFBundlePackageType</key>
20- <string>APPL</string>
21- <key>CFBundleSignature</key>
22- <string>????</string>
23- <key>CFBundleVersion</key>
24- <string>@BundleVersion@</string>
25- <key>CFBundleShortVersionString</key>
26- <string>@BundleShortVersionString@</string>
27- <key>NSHumanReadableCopyright</key>
28- <string>@NSHumanReadableCopyright@</string>
29- <key>NSHighResolutionCapable</key>
30- <true/>
31- <key>NSSupportsAutomaticGraphicsSwitching</key>
32- <true/>
33- <key>ExecutableJar</key>
34- <string>Resources/CharacterManaJ.jar</string>
35- </dict>
4+<dict>
5+ <key>CFBundleDevelopmentRegion</key>
6+ <string>English</string>
7+ <key>CFBundleExecutable</key>
8+ <string>JavaLaunch</string>
9+ <key>CFBundleIconFile</key>
10+ <string>icon.icns</string>
11+ <key>CFBundleIdentifier</key>
12+ <string>charactermanaj.CharacterManaJ</string>
13+ <key>CFBundleDisplayName</key>
14+ <string>CharacterManaJ</string>
15+ <key>CFBundleInfoDictionaryVersion</key>
16+ <string>6.0</string>
17+ <key>CFBundleName</key>
18+ <string>CharacterManaJ</string>
19+ <key>CFBundlePackageType</key>
20+ <string>APPL</string>
21+ <key>CFBundleSignature</key>
22+ <string>????</string>
23+ <key>CFBundleVersion</key>
24+ <string>@BundleVersion@</string>
25+ <key>CFBundleShortVersionString</key>
26+ <string>@BundleShortVersionString@</string>
27+ <key>NSHumanReadableCopyright</key>
28+ <string>@NSHumanReadableCopyright@</string>
29+ <key>NSHighResolutionCapable</key>
30+ <true/>
31+ <key>NSSupportsAutomaticGraphicsSwitching</key>
32+ <true/>
33+ <key>JVMOptions</key>
34+ <array>
35+ <!--
36+ アプリケーションバンドルとデータをセットで配備する場合は以下のように設定する
37+ <string>-DcharactersDir=$APP_ROOT/Contents/Characters</string>
38+ <string>-DappConfigFile=$APP_ROOT/Contents/Characters/appConfig.xml</string>
39+ -->
40+ </array>
41+ <key>ExecutableJar</key>
42+ <string>Resources/CharacterManaJ.jar</string>
43+</dict>
3644 </plist>
Binary files a/src/main/attachment/bundle/CharacterManaJ.app/Contents/MacOS/JavaLaunch and b/src/main/attachment/bundle/CharacterManaJ.app/Contents/MacOS/JavaLaunch differ
Show on old repository browser