mirror of https://github.com/Xhofe/alist
feat: skip creating an existing folder
parent
8a62d55efe
commit
4b540a2297
|
@ -158,10 +158,6 @@ func (driver MediaTrack) Preview(path string, account *model.Account) (interface
|
||||||
}
|
}
|
||||||
|
|
||||||
func (driver MediaTrack) MakeDir(path string, account *model.Account) error {
|
func (driver MediaTrack) MakeDir(path string, account *model.Account) error {
|
||||||
_, err := driver.File(path, account)
|
|
||||||
if err != base.ErrPathNotFound {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
parentFile, err := driver.File(utils.Dir(path), account)
|
parentFile, err := driver.File(utils.Dir(path), account)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -29,7 +29,11 @@ func File(driver base.Driver, account *model.Account, path string) (*model.File,
|
||||||
|
|
||||||
func MakeDir(driver base.Driver, account *model.Account, path string, clearCache bool) error {
|
func MakeDir(driver base.Driver, account *model.Account, path string, clearCache bool) error {
|
||||||
log.Debugf("mkdir: %s", path)
|
log.Debugf("mkdir: %s", path)
|
||||||
err := driver.MakeDir(path, account)
|
_, err := Files(driver, account, path)
|
||||||
|
if err != base.ErrPathNotFound {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
err = driver.MakeDir(path, account)
|
||||||
if err == nil && clearCache {
|
if err == nil && clearCache {
|
||||||
_ = base.DeleteCache(utils.Dir(path), account)
|
_ = base.DeleteCache(utils.Dir(path), account)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue