Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

Commit f974648

Browse files
committed
user-specified working directory, and subfolders for creators.
1 parent c204de8 commit f974648

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

PatreonDownloader/Program.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,30 @@
1414

1515
namespace PatreonDownloader {
1616
public class Program {
17-
private static string DataFolder { get; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PatreonDownloader");
17+
private static string DataFolder { get; set; }
1818

1919
private static void Main(string[] args) {
2020
try {
21+
do {
22+
Console.WriteLine("Please enter the full path of the folder where you want to store the downloaded files, or leave it empty to use your Documents folder.");
23+
Console.WriteLine("Make sure the directory currently exists. A folder named PatreonDownloader will be created inside it.");
24+
DataFolder = Console.ReadLine() ?? "";
25+
26+
if (DataFolder.Length == 0) {
27+
DataFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); // Unfortunately, no SpecialFolder.Downloads.
28+
}
29+
} while (!Directory.Exists(DataFolder));
30+
31+
DataFolder = Path.Combine(DataFolder, "PatreonDownloader");
32+
2133
Directory.CreateDirectory(DataFolder);
34+
35+
Console.WriteLine("If you want to create an extra folder inside the PatreonDownloader folder, enter its name - otherwise press enter:");
36+
string subfolderName = Console.ReadLine() ?? "";
37+
if (subfolderName.Length > 0) {
38+
DataFolder = Path.Combine(DataFolder, subfolderName);
39+
Directory.CreateDirectory(DataFolder);
40+
}
2241

2342
string sessionToken = null;
2443

@@ -48,7 +67,7 @@ private static void Main(string[] args) {
4867
}
4968
}
5069

51-
string backupFile = Path.Combine(DataFolder, "posts.json"); // Unfortunately, no SpecialFolder.Downloads.
70+
string backupFile = Path.Combine(DataFolder, "posts.json");
5271

5372
var cookieContainer = new CookieContainer();
5473
cookieContainer.Add(new Uri("https://www.patreon.com"), new Cookie("session_id", sessionToken));
@@ -104,6 +123,7 @@ private static void Main(string[] args) {
104123
}
105124
#endif
106125
finally {
126+
Console.WriteLine("The program has finished, press any key to exit.");
107127
Console.ReadKey();
108128
}
109129
}

0 commit comments

Comments
 (0)