Skip to content

Commit

Permalink
Update and rename Program.cs to spA.cs
Browse files Browse the repository at this point in the history
changed the filename
changed the classname
added the creation of appdata spar folder if not found
  • Loading branch information
skorpio07 authored May 6, 2024
1 parent 14f5340 commit 8b1ac02
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 23 deletions.
23 changes: 0 additions & 23 deletions Program.cs

This file was deleted.

38 changes: 38 additions & 0 deletions spA.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}

0 comments on commit 8b1ac02

Please sign in to comment.