Skip to content

Commit

Permalink
Move source download dirs to new download subfolder (#660)
Browse files Browse the repository at this point in the history
Should have been added with f2dd67d
  • Loading branch information
schroda authored Aug 20, 2023
1 parent 8db6c21 commit c42d314
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions server/src/main/kotlin/suwayomi/tachidesk/server/ServerSetup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,23 @@ fun applicationSetup() {
File("$ApplicationRootDir/manga-local").renameTo(applicationDirs.localMangaRoot)
File("$ApplicationRootDir/anime-thumbnails").delete()

val oldMangaDownloadDir = File(applicationDirs.downloadsRoot)
val newMangaDownloadDir = File(applicationDirs.mangaDownloadsRoot)
val downloadDirs = oldMangaDownloadDir.listFiles().orEmpty()

val moveDownloadsToNewFolder = !newMangaDownloadDir.exists() && downloadDirs.isNotEmpty()
if (moveDownloadsToNewFolder) {
newMangaDownloadDir.mkdirs()

for (downloadDir in downloadDirs) {
if (downloadDir == File(applicationDirs.thumbnailDownloadsRoot)) {
continue
}

downloadDir.renameTo(File(newMangaDownloadDir, downloadDir.name))
}
}

// make dirs we need
listOf(
applicationDirs.dataRoot,
Expand Down

0 comments on commit c42d314

Please sign in to comment.