mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-12 17:05:14 +00:00
Update the .env file location
This commit is contained in:
parent
c4be361f95
commit
3349255d9a
|
@ -14,8 +14,10 @@ namespace WelsonJS.Launcher
|
|||
{
|
||||
InitializeComponent();
|
||||
InitializeListView();
|
||||
// Set the variable file path in the temporary folder
|
||||
tempFilePath = Path.Combine(Path.GetTempPath(), "welsonjs_default.env");
|
||||
|
||||
// Set the variable file path
|
||||
tempFilePath = Path.Combine(Program.GetAppDataPath(), "welsonjs_default.env");
|
||||
|
||||
LoadUserVariables(); // Load variables
|
||||
}
|
||||
|
||||
|
|
|
@ -42,5 +42,22 @@ namespace WelsonJS.Service
|
|||
ServiceBase.Run(ServicesToRun);
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetAppDataPath()
|
||||
{
|
||||
string path = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
"welsonjs"
|
||||
);
|
||||
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
throw new IOException("Failed to create directory: " + path);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,10 +9,11 @@ namespace WelsonJS.Service
|
|||
{
|
||||
private ServiceMain parent;
|
||||
private Dictionary<string, string> userVariables;
|
||||
private readonly string envFilePath = Path.Combine(Path.GetTempPath(), "welsonjs_default.env");
|
||||
private string envFilePath;
|
||||
|
||||
public UserVariables(ServiceBase parent)
|
||||
{
|
||||
envFilePath = Path.Combine(Program.GetAppDataPath(), "welsonjs_default.env");
|
||||
this.parent = (ServiceMain)parent;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user