1
0
Эх сурвалжийг харах

Merge pull request #141 from wyq977/add-darwin

Add macOS setting
Chin allan 3 жил өмнө
parent
commit
553a6b6314

+ 5 - 0
internal/dao/init.go

@@ -88,6 +88,10 @@ func getDbName() string {
 	if sysType == "windows" {
 		nowDbFileName = dbFileNameWindows
 	}
+	if sysType == "darwin" {
+		home, _ := os.UserHomeDir()
+		nowDbFileName = home + "/.config/chinesesubfinder/" + dbFileNameDarwin
+	}
 	return nowDbFileName
 }
 
@@ -99,4 +103,5 @@ var (
 const (
 	dbFileNameLinux   = "/config/settings.db"
 	dbFileNameWindows = "settings.db"
+	dbFileNameDarwin  = "settings.db"
 )

+ 6 - 1
internal/logic/forced_scan_and_down_sub/forced_scan_and_down_sub.go

@@ -37,6 +37,10 @@ func getSpeFileName() string {
 	if sysType == "windows" {
 		nowSpeFileName = specialFileNameWindows
 	}
+	if sysType == "darwin" {
+		home, _ := os.UserHomeDir()
+		nowSpeFileName = home + "/.config/chinesesubfinder/" + specialFileNameDarwin
+	}
 	return nowSpeFileName
 }
 
@@ -44,9 +48,10 @@ func getSpeFileName() string {
 	识别 config 文件夹下面由这个特殊的文件,就会执行强制扫描所有视频文件进行字幕的下载(之前有的字幕会被覆盖)
 	对于 Linux 是 /config 文件夹下
 	对于 Windows 是程序根目录下
-	对于 MacOS 需要自行实现
+	对于 MacOS 是程序根目录下
 */
 const (
 	specialFileNameWindows = "ForceFullScanAndDownloadSub"
 	specialFileNameLinux   = "/config/" + specialFileNameWindows
+	specialFileNameDarwin = "ForceFullScanAndDownloadSub"
 )

+ 5 - 0
internal/logic/restore_fix_timeline_bk/restore_fix_timeline_bk.go

@@ -37,6 +37,10 @@ func getSpeFileName() string {
 	if sysType == "windows" {
 		nowSpeFileName = specialFileNameWindows
 	}
+	if sysType == "darwin" {
+		home, _ := os.UserHomeDir()
+		nowSpeFileName = home + "/.config/chinesesubfinder/" + specialFileNameDarwin
+	}
 	return nowSpeFileName
 }
 
@@ -49,4 +53,5 @@ func getSpeFileName() string {
 const (
 	specialFileNameWindows = "RestoreFixTimelineBK"
 	specialFileNameLinux   = "/config/" + specialFileNameWindows
+	specialFileNameDarwin  = "RestoreFixTimelineBK"
 )