From 6fd28ccf4a8845d99372d9a27fde5cb2b3acb64b Mon Sep 17 00:00:00 2001 From: jellejurre Date: Wed, 6 Mar 2024 10:51:35 +0100 Subject: [PATCH] Add 2019 support --- Instancer.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Instancer.cs b/Instancer.cs index 1305611..f2765af 100644 --- a/Instancer.cs +++ b/Instancer.cs @@ -76,13 +76,24 @@ static string PrepareTargetFolderPath(string folderPath, string packageName) static string GetSourceFolder(string installFilePath) { string sourceFolder = installFilePath; - +#if UNITY_2019 + while (!File.Exists("." + sourceFolder + "/package.json")) +#else while (!File.Exists(sourceFolder + "/package.json")) +#endif { - sourceFolder = Path.GetDirectoryName(sourceFolder); + if (sourceFolder == null) + { + throw new ArgumentException("Supplied path not in correct format"); + } + sourceFolder = Path.GetDirectoryName(sourceFolder); } - - return sourceFolder.Replace("\\", "/"); + +#if UNITY_2019 + return sourceFolder.Replace("\\", "/").Substring(1); +#else + return sourceFolder.Replace("\\", "/").Substring(2); +#endif } static string[] GetLocalAssetPaths(string sourceFolder, string[] excludeRegexs)