|
@@ -113,11 +113,15 @@ class PackageClass
|
|
|
//拷贝copy-files文件
|
|
|
self::copyFiles($packageInfo);
|
|
|
|
|
|
+ //替换文件内的宏变量
|
|
|
+ self::macoFiles($packageInfo);
|
|
|
+
|
|
|
//注册全局路径
|
|
|
self::registerPath($packageInfo);
|
|
|
|
|
|
//注册自启动程序
|
|
|
self::registerAutorun($packageInfo);
|
|
|
+
|
|
|
}
|
|
|
//初始化
|
|
|
private static function initialize($vendorDir)
|
|
@@ -345,7 +349,7 @@ class PackageClass
|
|
|
$rootDir = $packageInfo['rootDir'];
|
|
|
$copyFiles = $app["distribute-root"]["copy-files"] ? : array();
|
|
|
foreach($copyFiles as $fileInfo){
|
|
|
- $fileName = $fileInfo['name'];
|
|
|
+ $fileName = $fileInfo['path'];
|
|
|
$targetName = $fileInfo['target'];
|
|
|
$filePath = pathJoin($rootDir,$fileName);
|
|
|
if(! file_exists($filePath) ){
|
|
@@ -366,6 +370,38 @@ class PackageClass
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
+ private static function macoFiles($packageInfo)
|
|
|
+ {
|
|
|
+ $app = self::$app;
|
|
|
+ $cacheDir = $packageInfo['cacheDir'];
|
|
|
+ $repoName = $packageInfo['repoName'];
|
|
|
+ $version = $packageInfo['version'];
|
|
|
+ $rootDir = $packageInfo['rootDir'];
|
|
|
+ $macroFiles = $app["distribute-root"]["macro-files"] ? : array();
|
|
|
+
|
|
|
+ $macros = array(
|
|
|
+ '{root}' => $rootDir
|
|
|
+ );
|
|
|
+ foreach($macroFiles as $fileInfo){
|
|
|
+ $fileName = $fileInfo['path'];
|
|
|
+ $filePath = pathJoin($rootDir,$fileName);
|
|
|
+ if(! file_exists($filePath) ){
|
|
|
+ logError("failed to replace macro file, file not exists.",$filePath);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $targetName = $fileInfo['target'];
|
|
|
+ $targetPath = pathJoin($rootDir,$targetName);
|
|
|
+ if( replaceMacro($filePath,$targetPath,$macros) ){
|
|
|
+ logInfo("succeeded to replace macro file",$fileName);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ logError("failed to replace macro file",$filePath);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
private static function registerPath($packageInfo)
|
|
|
{
|
|
|
}
|