update: 添加 Adjust Signature V3 文件自动导入的指令

--story=1021227 --user=yufei.hu 【中台】【变现】添加 Adjust Signature V3 文件导入功能 https://www.tapd.cn/33527076/s/1161236

Signed-off-by: huyufei <yufei.hu@castbox.fm>
胡宇飞 2024-08-01 15:40:34 +08:00
parent 95271aaa98
commit 719be42b59
1 changed files with 17 additions and 17 deletions

View File

@ -20,19 +20,19 @@ namespace Guru
bool res; bool res;
from = $"{files}/{AndroidLib}.f"; from = $"{files}/{AndroidLib}.f";
to = $"{Application.dataPath}/Plugins/Android/{AndroidLib}"; to = $"{Application.dataPath}/Plugins/Android/{AndroidLib}";
res = CopyFile(from, to); res = CopyFile(from, to); // 无需覆盖
if (res) Debug.Log($"Copy <color=#88ff00>{AndroidLib} to {to}</color> success..."); if (res) Debug.Log($"Copy <color=#88ff00>{AndroidLib} to {to}</color> success...");
from = $"{files}/{AndroidLib}.f.meta"; from = $"{files}/{AndroidLib}.f.meta";
to = $"{Application.dataPath}/Plugins/Android/{AndroidLib}.meta"; to = $"{Application.dataPath}/Plugins/Android/{AndroidLib}.meta";
CopyFile(from, to); CopyFile(from, to); // 无需覆盖
from = $"{files}/{iOSLib}.f"; from = $"{files}/{iOSLib}.f";
to = $"{Application.dataPath}/Plugins/iOS/{iOSLib}"; to = $"{Application.dataPath}/Plugins/iOS/{iOSLib}";
res = CopyFile(from, to); res = CopyFile(from, to); // 无需覆盖
if (res) Debug.Log($"Copy <color=#88ff00>{iOSLib} to {to}</color> success..."); if (res) Debug.Log($"Copy <color=#88ff00>{iOSLib} to {to}</color> success...");
from = $"{files}/{iOSLib}.f.meta"; from = $"{files}/{iOSLib}.f.meta";
to = $"{Application.dataPath}/Plugins/iOS/{iOSLib}.meta"; to = $"{Application.dataPath}/Plugins/iOS/{iOSLib}.meta";
CopyFile(from, to); CopyFile(from, to); // 无需覆盖
AssetDatabase.Refresh(); AssetDatabase.Refresh();
} }
@ -55,25 +55,25 @@ namespace Guru
return Path.GetFullPath($"{Application.dataPath}/../Packages/com.guru.unity.sdk.core/Runtime/GuruAdjust/Editor/Signature"); return Path.GetFullPath($"{Application.dataPath}/../Packages/com.guru.unity.sdk.core/Runtime/GuruAdjust/Editor/Signature");
} }
private static bool CopyFile(string source, string dest) private static bool CopyFile(string from, string to, bool overwrite = false)
{ {
if (File.Exists(source)) if (File.Exists(to) && !overwrite)
{ {
if (!File.Exists(dest)) // 如果目标文件存在, 且不允许覆写, 则不进行拷贝
{ return false;
File.Delete(dest); }
}
else if (File.Exists(from))
{ {
var destDir = Directory.GetParent(dest); // 确保拷贝目录存在
if(!destDir.Exists) destDir.Create(); var destDir = Directory.GetParent(to);
} if(destDir != null && !destDir.Exists) destDir.Create();
File.Copy(source, dest, true); File.Copy(from, to, overwrite);
return true; return true;
} }
Debug.Log($"<colo=red>File not found: {source}...</color>"); Debug.Log($"<colo=red>File not found: {from}...</color>");
return false; return false;
} }