public void AddByPath(string path) { if (isAddRemoveOrEmbedInProgress) { return; } path = path.Replace('\\', '/'); var projectPath = Path.GetDirectoryName(Application.dataPath).Replace('\\', '/') + '/'; if (path.StartsWith(projectPath)) { var packageFolderPrefix = "Packages/"; var relativePathToProjectRoot = path.Substring(projectPath.Length); if (relativePathToProjectRoot.StartsWith(packageFolderPrefix, StringComparison.InvariantCultureIgnoreCase)) { path = relativePathToProjectRoot.Substring(packageFolderPrefix.Length); } else { path = $"../{relativePathToProjectRoot}"; } } m_AddOperation.AddByUrlOrPath($"file:{path}"); SetupAddOperation(); }
public void AddByUrl(string url) { if (isAddRemoveOrEmbedInProgress) { return; } // convert SCP-like syntax to SSH URL as currently UPM doesn't support it if (url.ToLower().StartsWith("git@")) { url = "ssh://" + url.Replace(':', '/'); } m_AddOperation.AddByUrlOrPath(url); SetupAddOperation(); }