bool IsInternalizedPackagePath(string file) { if (string.IsNullOrWhiteSpace(file)) { return(false); } var packageInfo = m_AssemblyNameProvider.FindForAssetPath(file); if (packageInfo == null) { return(false); } var packageSource = packageInfo.source; return(packageSource != PackageSource.Embedded && packageSource != PackageSource.Local); }
IEnumerable <SolutionProjectEntry> ToProjectEntries(IEnumerable <Assembly> assemblies) { foreach (var assembly in assemblies) { yield return new SolutionProjectEntry() { ProjectFactoryGuid = SolutionGuid(assembly), Name = assembly.name, FileName = Path.GetFileName(ProjectFile(assembly)), ProjectGuid = ProjectGuid(assembly), Metadata = k_WindowsNewline } } ; } /// <summary> /// Generate the active configuration string for a given project guid /// </summary> string GetProjectActiveConfigurations(string projectGuid) { return(string.Format( m_SolutionProjectConfigurationTemplate, projectGuid)); } string EscapedRelativePathFor(string file) { var projectDir = FileUtility.Normalize(ProjectDirectory); file = FileUtility.Normalize(file); var path = SkipPathPrefix(file, projectDir); var packageInfo = m_AssemblyNameProvider.FindForAssetPath(path.Replace('\\', '/')); if (packageInfo != null) { // We have to normalize the path, because the PackageManagerRemapper assumes // dir seperators will be os specific. var absolutePath = Path.GetFullPath(FileUtility.Normalize(path)); path = SkipPathPrefix(absolutePath, projectDir); } return(XmlFilename(path)); }
private string EscapedRelativePathFor(string file) { var projectDir = ProjectDirectory.Replace('/', '\\'); file = file.Replace('/', '\\'); var path = SkipPathPrefix(file, projectDir); var packageInfo = m_AssemblyNameProvider.FindForAssetPath(path.Replace('\\', '/')); if (packageInfo != null) { // We have to normalize the path, because the PackageManagerRemapper assumes // dir seperators will be os specific. var absolutePath = Path.GetFullPath(NormalizePath(path)).Replace('/', '\\'); path = SkipPathPrefix(absolutePath, projectDir); } return(SecurityElement.Escape(path)); }
string EscapedRelativePathFor(string file) { var projectDir = _projectDirectory.ConvertSeparatorsToWindows(); file = file.ConvertSeparatorsToWindows(); var path = SkipPathPrefix(file, projectDir); var packageInfo = m_assemblyNameProvider.FindForAssetPath(path.ConvertSeparatorsToUnity()); if (packageInfo != null) { // We have to normalize the path, because the PackageManagerRemapper assumes // dir seperators will be os specific. var absolutePath = Path.GetFullPath(NormalizePath(path)).ConvertSeparatorsToWindows(); path = SkipPathPrefix(absolutePath, projectDir); } return(SecurityElement.Escape(path)); }
private string EscapedRelativePathFor(string file, out UnityEditor.PackageManager.PackageInfo packageInfo) { var projectDir = ProjectDirectory.NormalizePathSeparators(); file = file.NormalizePathSeparators(); var path = SkipPathPrefix(file, projectDir); packageInfo = m_AssemblyNameProvider.FindForAssetPath(path.NormalizeWindowsToUnix()); if (packageInfo != null) { // We have to normalize the path, because the PackageManagerRemapper assumes // dir seperators will be os specific. var absolutePath = Path.GetFullPath(path.NormalizePathSeparators()); path = SkipPathPrefix(absolutePath, projectDir); } return(XmlFilename(path)); }