From 8b1ac022f563ab15572aacb638d8c5a6014ed53e Mon Sep 17 00:00:00 2001 From: skorpio07 Date: Mon, 6 May 2024 13:50:38 -0400 Subject: [PATCH] Update and rename Program.cs to spA.cs changed the filename changed the classname added the creation of appdata spar folder if not found --- Program.cs | 23 ----------------------- spA.cs | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 23 deletions(-) delete mode 100644 Program.cs create mode 100644 spA.cs diff --git a/Program.cs b/Program.cs deleted file mode 100644 index 3c6bb7e..0000000 --- a/Program.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.IO; - -public class Program -{ - public static void Main() - { - // Get the current directory - string currentDirectory = Environment.CurrentDirectory; - - // Prepare the command to set the path - string command = $"@cd /d {currentDirectory}"; - - // Get the path to the temp folder - string tempPath = Path.GetTempPath(); - - // Create the full path to the .cmd file in the temp folder - string cmdFilePath = Path.Combine(tempPath, "SetPath.cmd"); - - // Write the command to a .cmd file in the temp folder - File.WriteAllText(cmdFilePath, command); - } -} \ No newline at end of file diff --git a/spA.cs b/spA.cs new file mode 100644 index 0000000..d3650ad --- /dev/null +++ b/spA.cs @@ -0,0 +1,38 @@ +using System; +using System.IO; + +public class spA +{ + public static void Main() + { + // Get the current directory + string currentDirectory = Environment.CurrentDirectory; + + // Prepare the command to set the path + string command = $"@cd /d {currentDirectory}"; + + // Get the path to the AppData folder + string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); + + // Specify the new folder in AppData + string folderName = "SavePathAndReturn"; + string tempPath = Path.Combine(appDataPath, folderName); + + // Check if the folder exists and create it if it doesn't + CreateFolderIfNotExists(tempPath); + + // Create the full path to the .cmd file in the new folder + string cmdFilePath = Path.Combine(tempPath, "SetPath.cmd"); + + // Write the command to a .cmd file in the new folder + File.WriteAllText(cmdFilePath, command); + } + + private static void CreateFolderIfNotExists(string folderPath) + { + if (!Directory.Exists(folderPath)) + { + Directory.CreateDirectory(folderPath); + } + } +}