Skip to content

Commit a3d4832

Browse files
author
Ethorbit
committed
Handle more exceptions
1 parent 70f3c6e commit a3d4832

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

FastDL Generator/Program.cs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public static void Main(string[] args)
1515
int RunningTasks = 0;
1616
int MaxTasks = 2;
1717
int HardLimit = 4;
18+
1819
// Define Filetypes
1920
string[] SearchFor = new string[] {
2021
"materials/*.vmt",
@@ -53,7 +54,7 @@ public static void Main(string[] args)
5354
}
5455

5556
// Same as above but instead quitting just set default path as the target path
56-
string copyPath = MainPath + "/../FastDL_Upload/";
57+
string copyPath = MainPath + $"/../fastdl-{Path.GetFileName(MainPath)}";
5758
try
5859
{
5960
if (Directory.Exists(args[1]))
@@ -166,19 +167,29 @@ void ThreadedCompressing()
166167
Console.WriteLine("All Threads Killed, Generator closed");
167168

168169
// Save the fastdl.lua in the target folder
169-
File.WriteAllText(copyPath + "/fastdl.lua", FileData);
170+
File.WriteAllText(copyPath + $"/fastdl-{Path.GetFileName(MainPath)}.lua", FileData);
170171
}
171172
}
172173

173174
}
174-
175-
175+
176176
private static void CopyFile(string Filee,string oldFolder, string NewFolder)
177177
{
178178
string oldFile = oldFolder+"/"+ Filee;
179179
string newFile = NewFolder+"/"+ Filee;
180-
Directory.CreateDirectory(newFile);
181-
Directory.Delete(newFile); // hacky way
180+
181+
try
182+
{
183+
Directory.CreateDirectory(newFile);
184+
}
185+
catch (Exception) { }
186+
187+
try
188+
{
189+
Directory.Delete(newFile); // hacky way
190+
}
191+
catch (Exception) { }
192+
182193
try
183194
{
184195
File.Copy(oldFile, newFile, true);

0 commit comments

Comments
 (0)