4 using System.Collections.Generic;
6 using SiliconStudio.Core.IO;
8 namespace SiliconStudio.Assets.Analysis
10 internal class CommonAnalysis
14 if (parameters == null)
throw new ArgumentNullException(
"parameters");
16 var fileDirectory = parentFileSync.FullPath.GetParent();
18 foreach (var assetReferenceLink
in paths)
20 var currentLocation = (
UPath)assetReferenceLink.Reference;
23 var upathAttribute = assetReferenceLink.Path.GetCustomAttribute<UPathAttribute>();
24 if (upathAttribute != null && upathAttribute.RelativeTo ==
UPathRelativeTo.None)
29 UPath newLocation = null;
31 var uFile = currentLocation as
UFile;
34 var previousLocationOnDisk = UPath.Combine(fileDirectory, uFile);
37 newLocation = parameters.ConvertUPathTo == UPathType.Relative ? previousLocationOnDisk.MakeRelative(fileDirectory) : previousLocationOnDisk;
43 var previousDirectoryOnDisk = UPath.Combine(fileDirectory, uDirectory);
46 newLocation = parameters.ConvertUPathTo == UPathType.Relative ? previousDirectoryOnDisk.MakeRelative(fileDirectory) : previousDirectoryOnDisk;
50 if (currentLocation != newLocation)
52 assetReferenceLink.UpdateReference(null, newLocation != null ? newLocation.FullPath : null);
53 if (parameters.SetDirtyFlagOnAssetWhenFixingUFile)
55 parentFileSync.IsDirty =
true;
61 if ((currentLocation.IsAbsolute && parameters.ConvertUPathTo ==
UPathType.Absolute && parameters.SetDirtyFlagOnAssetWhenFixingAbsoluteUFile))
63 parentFileSync.IsDirty =
true;
Defines a normalized directory path. See UPath for details. This class cannot be inherited.
UPathType
Describes if a UPath is relative or absolute.
Base class that describes a uniform path and provides method to manipulate them. Concrete class are U...
UPathRelativeTo
Enum UPathRelativeTo
Defines a normalized file path. See UPath for details. This class cannot be inherited.