mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-22 14:35:52 +00:00
Copy CFBundleIconFile in NativeHost building.
This commit is contained in:
1 parent
c41ffc14c7
commit
5ff798306f
1 file changed
+17
-7
@@ -4,26 +4,28 @@ var OS = require("os");
|
||||
var NATIVEHOST_SOURCE = FILE.path(module.path).dirname().dirname().dirname().join("support", "NativeHost.app");
|
||||
|
||||
exports.buildNativeHost = function(rootPath, buildNative, options) {
|
||||
rootPath = FILE.path(rootPath);
|
||||
buildNative = FILE.path(buildNative);
|
||||
|
||||
if (FILE.exists(buildNative))
|
||||
FILE.rmtree(buildNative);
|
||||
if (buildNative.exists())
|
||||
buildNative.rmtree();
|
||||
|
||||
// If not we lose all of our permissions.
|
||||
FILE.mkdirs(FILE.dirname(buildNative));
|
||||
buildNative.dirname().mkdirs();
|
||||
OS.system(["cp", "-r", NATIVEHOST_SOURCE, buildNative]);
|
||||
|
||||
// Do this again anyways?
|
||||
FILE.chmod(FILE.join(buildNative, "Contents", "MacOS", "NativeHost"), 0755);
|
||||
FILE.chmod(buildNative.join("Contents", "MacOS", "NativeHost"), 0755);
|
||||
|
||||
var buildClientDirectory = FILE.join(buildNative, "Contents", "Resources", "Application");
|
||||
var buildClientDirectory = buildNative.join("Contents", "Resources", "Application");
|
||||
|
||||
FILE.mkdirs(FILE.dirname(buildClientDirectory));
|
||||
OS.system(["cp", "-r", rootPath, buildClientDirectory]);
|
||||
// FILE.copyTree(rootPath, buildClientDirectory);
|
||||
|
||||
var defaultBundleName = FILE.basename(buildNative).match(/^(.*)(\.app)?$/)[1];
|
||||
var defaultBundleName = buildNative.basename().match(/^(.*)(\.app)?$/)[1];
|
||||
|
||||
CFPropertyList.modifyPlist(FILE.join(buildNative, "Contents", "Info.plist"), function(plist) {
|
||||
CFPropertyList.modifyPlist(buildNative.join("Contents", "Info.plist"), function(plist) {
|
||||
plist.setValueForKey("CFBundleName", defaultBundleName);
|
||||
plist.setValueForKey("NHInitialResource", "Application/index.html");
|
||||
|
||||
@@ -35,6 +37,14 @@ exports.buildNativeHost = function(rootPath, buildNative, options) {
|
||||
|
||||
if (key === "CPBundleName")
|
||||
plist.setValueForKey("CFBundleName", value);
|
||||
|
||||
if (key === "CFBundleIconFile") {
|
||||
var iconPath = rootPath.join("Resources", value);
|
||||
if (iconPath.isFile())
|
||||
iconPath.copy(buildNative.join("Contents", "Resources", value));
|
||||
else
|
||||
print("Warning: CFBundleIconFile references " + value + " but does not exist in the resources directory.");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user