public void InitializeDirectoryPathsCorrectly() { var settings = new ABConverter.Client.Settings(ContentServerUtils.ApiTLD.ZONE); settings.deleteDownloadPathAfterFinished = false; env = ABConverter.Environment.CreateWithDefaultImplementations(); core = new ABConverter.Core(env, settings); core.InitializeDirectoryPaths(false); Assert.IsFalse(string.IsNullOrEmpty(core.settings.finalAssetBundlePath)); Assert.IsFalse(string.IsNullOrEmpty(core.finalDownloadedPath)); Assert.IsTrue(env.directory.Exists(core.settings.finalAssetBundlePath)); Assert.IsTrue(env.directory.Exists(core.finalDownloadedPath)); string file1 = core.settings.finalAssetBundlePath + "test.txt"; string file2 = core.finalDownloadedPath + "test.txt"; env.file.WriteAllText(file1, "test"); env.file.WriteAllText(file2, "test"); core.InitializeDirectoryPaths(true); Assert.IsFalse(env.file.Exists(file1)); Assert.IsFalse(env.file.Exists(file2)); }
public static void DumpEmptyParcels(string folderName = "empty-scenes") { string indexJsonPath = Application.dataPath; indexJsonPath += $"/../../kernel/static/loader/{folderName}/index.json"; if (!File.Exists(indexJsonPath)) { Debug.LogError("Index.json path doesn't exists! Make sure to 'make watch' first so it gets generated."); return; } string emptyScenes = File.ReadAllText(indexJsonPath); var es = JsonUtility.FromJson <EmptyParcels>(emptyScenes); List <MappingPair> mappings = new List <MappingPair>(); mappings.AddRange(es.EP_01); mappings.AddRange(es.EP_02); mappings.AddRange(es.EP_03); mappings.AddRange(es.EP_04); mappings.AddRange(es.EP_05); mappings.AddRange(es.EP_06); mappings.AddRange(es.EP_07); mappings.AddRange(es.EP_08); mappings.AddRange(es.EP_09); mappings.AddRange(es.EP_10); mappings.AddRange(es.EP_11); mappings.AddRange(es.EP_12); string emptyScenesResourcesPath = Application.dataPath; emptyScenesResourcesPath += $"/../../kernel/static/loader/{folderName}"; string customBaseUrl = "file://" + emptyScenesResourcesPath; var settings = new ABConverter.Client.Settings(ApiTLD.NONE); settings.skipAlreadyBuiltBundles = true; settings.deleteDownloadPathAfterFinished = false; settings.baseUrl = customBaseUrl + "/contents/"; var core = new ABConverter.Core(ABConverter.Environment.CreateWithDefaultImplementations(), settings); core.Convert(mappings.ToArray()); }
public void SetUp() { ResetCacheAndWorkingFolders(); var settings = new ABConverter.Client.Settings(ContentServerUtils.ApiTLD.ZONE); settings.deleteDownloadPathAfterFinished = false; env = ABConverter.Environment.CreateWithMockImplementations(); core = new ABConverter.Core(env, settings); if (env.webRequest is Mocked.WebRequest mockedReq) { mockedReq.mockedContent.Add($"{baseUrl}{hash1}", contentData1); mockedReq.mockedContent.Add($"{baseUrl}{hash2}", contentData2); mockedReq.mockedContent.Add($"{baseUrl}{hash3}", contentData3); } }