fix: local storage dir

This commit is contained in:
Simon Ding
2024-07-30 16:12:10 +08:00
parent 6ef4bedebe
commit 88a554b186
3 changed files with 13 additions and 9 deletions

View File

@@ -85,10 +85,10 @@ func (l *LocalStorage) ReadDir(dir string) ([]fs.FileInfo, error) {
} }
func (l *LocalStorage) ReadFile(name string) ([]byte, error) { func (l *LocalStorage) ReadFile(name string) ([]byte, error) {
return os.ReadFile(name) return os.ReadFile(filepath.Join(l.dir, name))
} }
func (l *LocalStorage) WriteFile(name string, data []byte) error { func (l *LocalStorage) WriteFile(name string, data []byte) error {
return os.WriteFile(name, data, os.ModePerm) return os.WriteFile(filepath.Join(l.dir, name), data, os.ModePerm)
} }

View File

@@ -31,8 +31,7 @@ func (s *Server) createPlexmatchIfNotExists(seriesId int) error {
if err != nil { if err != nil {
//create new //create new
log.Warnf(".plexmatch file not found, create new one: %s", series.NameEn) log.Warnf(".plexmatch file not found, create new one: %s", series.NameEn)
st.WriteFile(filepath.Join(series.TargetDir, ".plexmatch"), []byte(fmt.Sprintf("tmdbid=%d\n",series.TmdbID))) return st.WriteFile(filepath.Join(series.TargetDir, ".plexmatch"), []byte(fmt.Sprintf("tmdbid=%d\n",series.TmdbID)))
return nil
} }
return nil return nil
} }

View File

@@ -248,23 +248,28 @@ class _MainSkeletonState extends State<MainSkeleton> {
}, },
destinations: const <NavigationDestination>[ destinations: const <NavigationDestination>[
NavigationDestination( NavigationDestination(
icon: Icon(Icons.live_tv), icon: Icon(Icons.live_tv_outlined),
selectedIcon: Icon(Icons.live_tv),
label: '剧集', label: '剧集',
), ),
NavigationDestination( NavigationDestination(
icon: Icon(Icons.movie), icon: Icon(Icons.movie_outlined),
selectedIcon: Icon(Icons.movie),
label: '电影', label: '电影',
), ),
NavigationDestination( NavigationDestination(
icon: Icon(Icons.download), icon: Icon(Icons.download_outlined),
selectedIcon: Icon(Icons.download),
label: '活动', label: '活动',
), ),
NavigationDestination( NavigationDestination(
icon: Icon(Icons.settings), icon: Icon(Icons.settings_outlined),
selectedIcon: Icon(Icons.settings),
label: '设置', label: '设置',
), ),
NavigationDestination( NavigationDestination(
icon: Icon(Icons.computer_rounded), icon: Icon(Icons.computer_outlined),
selectedIcon: Icon(Icons.computer),
label: '系统', label: '系统',
), ),
], ],