From 139ffc9f4a6dfea8b7b02bb85396fb198b72c4d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Wed, 9 Jul 2014 23:05:50 +0200 Subject: [PATCH] Making sure paths used for file system data storage (hdds, floppies) are directories or don't exist by trying to delete them if they're files, instead of just giving up - since apparently these can appear in some obscure scenario that can't be reproduced anymore. --- src/main/scala/li/cil/oc/server/fs/FileSystem.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/scala/li/cil/oc/server/fs/FileSystem.scala b/src/main/scala/li/cil/oc/server/fs/FileSystem.scala index 128419046..075b5dd9d 100644 --- a/src/main/scala/li/cil/oc/server/fs/FileSystem.scala +++ b/src/main/scala/li/cil/oc/server/fs/FileSystem.scala @@ -81,6 +81,9 @@ object FileSystem extends api.detail.FileSystemAPI { override def fromSaveDirectory(root: String, capacity: Long, buffered: Boolean) = { val path = new io.File(DimensionManager.getCurrentSaveRootDirectory, Settings.savePath + root) + if (!path.isDirectory) { + path.delete() + } path.mkdirs() if (path.exists() && path.isDirectory) { if (buffered) new BufferedFileSystem(path, capacity)