Skip to content

Commit 8cebbd2

Browse files
author
Jan Guegel
committed
change to use getDoesFilePathExists function
1 parent b25ad92 commit 8cebbd2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

app/src/main/kotlin/org/fossify/filemanager/activities/SaveAsActivity.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,14 @@ class SaveAsActivity : SimpleActivity() {
102102
val ext = if (file.extension.isNotEmpty()) ".${file.extension}" else ""
103103

104104
var index = 1
105-
var newFile: File
105+
var newPath: String
106106

107107
do {
108-
val newName = "${name}_${index}$ext"
109-
newFile = File(parent, newName)
108+
newPath = "$parent/${name}_$index$ext"
110109
index++
111-
} while (newFile.exists())
110+
} while (getDoesFilePathExist(newPath))
112111

113-
return newFile.absolutePath
112+
return newPath
114113
}
115114

116115
}

0 commit comments

Comments
 (0)