You've already forked com.unity.ide.cursor
mirror of
https://github.com/boxqkrtm/com.unity.ide.cursor.git
synced 2026-05-16 23:40:07 +00:00
com.unity.ide.visualstudio@2.0.7
## [2.0.7] - 2021-02-02 Integration: Remove com.unity.nuget.newtonsoft-json dependency in favor of the built-in JsonUtility for the VS Test Runner. ## [2.0.6] - 2021-01-20 Project generation: - Improved language version detection. Integration: - Added support for the VS Test Runner. - Added initial support for displaying asset usage. - Fixed remaining issues with special characters in file/path.
This commit is contained in:
@@ -57,7 +57,17 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
return path.Replace(WinSeparator, UnixSeparator);
|
||||
}
|
||||
|
||||
internal static bool IsFileInProjectDirectory(string fileName)
|
||||
internal static bool IsFileInProjectRootDirectory(string fileName)
|
||||
{
|
||||
var relative = MakeRelativeToProjectPath(fileName);
|
||||
if (string.IsNullOrEmpty(relative))
|
||||
return false;
|
||||
|
||||
return relative == Path.GetFileName(relative);
|
||||
}
|
||||
|
||||
// returns null if outside of the project scope
|
||||
internal static string MakeRelativeToProjectPath(string fileName)
|
||||
{
|
||||
var basePath = Path.GetFullPath(Path.Combine(Application.dataPath, ".."));
|
||||
fileName = Normalize(fileName);
|
||||
@@ -65,7 +75,13 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
if (!Path.IsPathRooted(fileName))
|
||||
fileName = Path.Combine(basePath, fileName);
|
||||
|
||||
return string.Equals(Path.GetDirectoryName(fileName), basePath, StringComparison.OrdinalIgnoreCase);
|
||||
if (!fileName.StartsWith(basePath, StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
return fileName
|
||||
.Substring(basePath.Length)
|
||||
.Trim(Path.DirectorySeparatorChar);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user