• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

CLI interface to medialist (fossil mirror)


Commit MetaInfo

修訂36e852a57da77146d3d17bb95234975cebd50e8c (tree)
時間2023-03-28 16:28:12
作者mio <stigma@disr...>
Commitermio

Log Message

Update main.d to remove deprecation warnings from mlib

FossilOrigin-Name: 6a812b90dbb08dae2a99418d2482fd41bef0bb6be8fa09254b52620d8bc527a0

Change Summary

差異

--- a/.fossil-settings/ignore-glob
+++ b/.fossil-settings/ignore-glob
@@ -1,7 +1,10 @@
11 *.o
2+*.a
23 *.html
34 *.txt
45 *.json
56 *.pdf
67 *.aux
78 *~
9+
10+medialist-cli
--- a/main.d
+++ b/main.d
@@ -1048,10 +1048,9 @@ private bool importList(string data_dir, string[] args) {
10481048 ///
10491049 /// Setup the logger for medialist-cli.
10501050 ///
1051-void setupLogger()
1051+void setupLogger(in ref ProjectDirectories projectDirs)
10521052 {
1053- DirEntry stateEntry = open(Directory.state);
1054- string logDirPath = buildPath(stateEntry.name, "medialist-cli");
1053+ string logDirPath = projectDirs.cacheDir;
10551054
10561055 if (false == exists(logDirPath)) {
10571056 mkdirRecurse(logDirPath);
@@ -1076,11 +1075,10 @@ void setupLogger()
10761075 }
10771076
10781077 int main(string[] args) {
1079- DirEntry configEntry = open(Directory.config);
1080- DirEntry dataEntry = open(Directory.data);
1078+ // idk? will think of something
1079+ ProjectDirectories projectDirs = getProjectDirectories(null, "YumeNeru Productions", "medialist");
1080+ string dataDirectory = projectDirs.dataDir; // default directory.
10811081
1082- string config_dir = buildPath(configEntry.name, "medialist");
1083- string data_dir = buildPath(dataEntry.name, "medialist");
10841082 string command = "help";
10851083
10861084 version(appimage) {
@@ -1089,7 +1087,7 @@ version(appimage) {
10891087 string program_name = args[0];
10901088 }
10911089
1092- setupLogger();
1090+ setupLogger(projectDirs);
10931091
10941092 bool success = true;
10951093 /* Default behaviour since 0.3 */
@@ -1125,15 +1123,15 @@ version(appimage) {
11251123 }
11261124
11271125 command = args[1];
1128- mkdirRecurse(config_dir);
1126+ mkdirRecurse(projectDirs.configDir);
11291127
1130- if (buildPath(config_dir, "medialist.conf").exists) {
1131- scope contents = readText(buildPath(config_dir, "medialist.conf"));
1128+ if (buildPath(projectDirs.configDir, "medialist.conf").exists) {
1129+ scope contents = readText(buildPath(projectDirs.configDir, "medialist.conf"));
11321130 auto conf = CniParser.fromString(contents, CniOptions(false, true));
11331131
11341132 if ("general.directory" in conf) {
11351133 trace("Using >=0.3 configuration section");
1136- data_dir = conf["general.directory"];
1134+ dataDirectory = conf["general.directory"];
11371135 } else if ("Lists.directory" in conf) {
11381136 /*
11391137 * COMPAT: For pre-0.2 versions of medialist. No need to remove,
@@ -1143,10 +1141,10 @@ version(appimage) {
11431141 stderr.writeln(`WARNING: Using the "Lists" section in your configuration is deprecated.`);
11441142 stderr.writeln(` Please change to using the "general" section.`);
11451143 stderr.writeln(` This warning (along with support for "Lists") will be removed v0.5`);
1146- data_dir = conf["Lists.directory"];
1144+ dataDirectory = conf["Lists.directory"];
11471145 }
11481146
1149- data_dir = expandEnvironmentVariables(expandTilde(data_dir));
1147+ dataDirectory = expandEnvironmentVariables(expandTilde(dataDirectory));
11501148
11511149 string shouldVerifyDeleteRaw;
11521150
@@ -1163,16 +1161,16 @@ version(appimage) {
11631161 }
11641162 }
11651163
1166- mkdirRecurse(data_dir);
1164+ mkdirRecurse(dataDirectory);
11671165
11681166 if ("import" == command) {
11691167 trace(`Command: import`);
1170- success = importList(data_dir, args[2..$]);
1168+ success = importList(dataDirectory, args[2..$]);
11711169 return success ? EXIT_SUCCESS : EXIT_FAILURE;
11721170 }
11731171
11741172 /* temporary mess while changing to the library format */
1175- string filePath = buildPath(data_dir, args[2] ~ ".tsv");
1173+ string filePath = buildPath(dataDirectory, args[2] ~ ".tsv");
11761174 MediaList *ml = null;
11771175
11781176 if (false == exists(filePath)) {