1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2026-02-12 01:58:47 +08:00

Old DemiLib Core files are now atutomatically deleted if new ones are present

This commit is contained in:
Demigiant 2015-12-06 11:32:15 +01:00
parent 28cf80f3cd
commit c1f7a0629a
44 changed files with 40 additions and 1 deletions

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.1.120";
public static readonly string Version = "1.1.130";
///////////////////////////////////////////////
// Options ////////////////////////////////////

View File

@ -5,6 +5,7 @@ using System;
using System.Collections;
using System.Reflection;
using System.IO;
using DG.Tweening;
using UnityEditor;
using UnityEngine;
@ -86,6 +87,40 @@ namespace DG.DOTweenEditor.Core
return Directory.GetFiles(dotweenDir, "*.addon").Length > 0 || hasPro && Directory.GetFiles(dotweenProDir, "*.addon").Length > 0;
}
// Deletes old DemiLib core if new one (inside Core directory) exists
public static void DeleteOldDemiLibCore()
{
string demiLibDir = EditorUtils.GetAssemblyFilePath(typeof(DOTween).Assembly);
string slash = demiLibDir.IndexOf("/") != -1 ? "/" : "\\";
demiLibDir = demiLibDir.Substring(0, demiLibDir.LastIndexOf(slash));
demiLibDir = demiLibDir.Substring(0, demiLibDir.LastIndexOf(slash)) + slash + "DemiLib";
string adbDemiLibDir = FullPathToADBPath(demiLibDir);
if (!AssetExists(adbDemiLibDir)) return;
string demiLibNewCoreDir = adbDemiLibDir + "/Core";
if (!AssetExists(demiLibNewCoreDir)) return;
// New version present, delete old versions
DeleteAssetsIfExist(new[] {
adbDemiLibDir + "/DemiLib.dll",
adbDemiLibDir + "/DemiLib.xml",
adbDemiLibDir + "/DemiLib.dll.mdb",
adbDemiLibDir + "/Editor/DemiEditor.dll",
adbDemiLibDir + "/Editor/DemiEditor.xml",
adbDemiLibDir + "/Editor/DemiEditor.dll.mdb",
adbDemiLibDir + "/Editor/Imgs"
});
// Delete Editor folder if empty
if (AssetExists(adbDemiLibDir + "/Editor") && Directory.GetFiles(demiLibDir + slash + "Editor").Length == 0)
AssetDatabase.DeleteAsset(adbDemiLibDir + "/Editor");
}
static void DeleteAssetsIfExist(string[] adbFilePaths)
{
foreach (string f in adbFilePaths) {
if (AssetExists(f)) AssetDatabase.DeleteAsset(f);
}
}
/// <summary>
/// Returns TRUE if the file/directory at the given path exists.
/// </summary>

View File

@ -2,6 +2,7 @@
// Created: 2014/12/24 13:37
using System.IO;
using System.Reflection;
using DG.DOTweenEditor.Core;
using DG.Tweening;
using DG.Tweening.Core;
@ -21,6 +22,9 @@ namespace DG.DOTweenEditor
string[] dotweenEntries = System.Array.FindAll(importedAssets, name => name.Contains("DOTween") && !name.EndsWith(".meta") && !name.EndsWith(".jpg") && !name.EndsWith(".png"));
bool dotweenImported = dotweenEntries.Length > 0;
if (dotweenImported) {
// Delete old DemiLib configuration
EditorUtils.DeleteOldDemiLibCore();
//
bool openSetupDialog = EditorUtils.DOTweenSetupRequired()
&& (EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.Id) != Application.dataPath + DOTween.Version
|| EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.IdPro) != Application.dataPath + EditorUtils.proVersion);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.