/// <summary> /// TODO: remove this once all the bugs are worked out. This saves us a little /// time by avoiding having to run the full Unity build every time we want to /// validate the post process. /// </summary> private static void ShowRerunButton() { // Displaying the current build location serves as a reminder to the user what is going on. var currentBuildLocation = EditorUserBuildSettings.GetBuildLocation(BuildTarget.iOS); bool hasBuildLocation = !string.IsNullOrEmpty(currentBuildLocation); if (hasBuildLocation) { currentBuildLocation = PathExt.Abs2Rel(currentBuildLocation); } else { currentBuildLocation = "<N/A>"; } GUILayout.Label( string.Format( "Current Build Location: {0}", currentBuildLocation)); if (hasBuildLocation && GUILayout.Button("Run post-build process")) { OnPostBuild(BuildTarget.iOS, currentBuildLocation); } else { GUILayout.Label("Please run build process for iOS."); } }
public override Task RunAsync() { to.Directory?.Create(); File.Copy(from.FullName, to.FullName, overwrite); var fromRel = PathExt.Abs2Rel(from.FullName, Environment.CurrentDirectory); var toRel = PathExt.Abs2Rel(to.FullName, Environment.CurrentDirectory); OnInfo($"Copied! {fromRel} -> {toRel}"); return(Task.CompletedTask); }
private static string[] GetFilesRelativePath(string directory) { var results = new List <string>(); if (Directory.Exists(directory)) { foreach (var path in Directory.GetFiles(directory, "*", SearchOption.AllDirectories)) { results.Add(PathExt.Abs2Rel(path, directory)); } } return(results.ToArray()); }
private void ShowSettings() { GUILayout.Label("Settings", EditorStyles.boldLabel); // If we don't have a directory root for the xcode project, just make a wild // guess at one to give the user a starting point for navigating to the real one. if (!Directory.Exists(XcodeProjectPath)) { XcodeProjectPath = null; } if (string.IsNullOrEmpty(XcodeProjectPath)) { XcodeProjectPath = PathExt.Combine( Path.GetDirectoryName(Environment.CurrentDirectory), "Xcode-Project.xcodeproj"); } // Instead of defining the xcode project root and name separately, have the user // select the .xcodeproj file and then figure them out from there. var xcodeProjectFile = PathExt.Abs2Rel(XcodeProjectPath); xcodeProjectFile = EditorGUILayout.TextField("Xcode Project File", xcodeProjectFile); if (GUILayout.Button("Browse...")) { string userSelection = null; if (Environment.OSVersion.Platform == PlatformID.MacOSX) { userSelection = EditorUtility.OpenFilePanelWithFilters( "Select Xcode project file", Path.GetDirectoryName(XcodeProjectPath), XCODEPROJ_FILTER); } else { userSelection = EditorUtility.OpenFolderPanel( "Select Xcode project file", Path.GetDirectoryName(XcodeProjectPath), "Xcode-Project.xcodeproj"); } if (!string.IsNullOrEmpty(userSelection)) { xcodeProjectFile = PathExt.Abs2Rel(userSelection); } } XcodeProjectPath = PathExt.Rel2Abs(xcodeProjectFile); }
/// <summary> /// Gets a file path for the given file, relative to a given directory. /// </summary> /// <param name="file">The file.</param> /// <param name="dir">The dir.</param> /// <returns></returns> public static string RelativeTo(this FileInfo file, DirectoryInfo dir) { if (file is null) { throw new ArgumentNullException(nameof(file)); } if (dir is null) { throw new ArgumentNullException(nameof(dir)); } return(PathExt.Abs2Rel(file.FullName, dir.FullName)); }