From 79cf72bf6ca38046e729cdffeb5cf2b3aae3dd78 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 31 Mar 2020 10:28:33 +0200 Subject: [PATCH] simplify filename fetching from path --- .../simplemobiletools/voicerecorder/services/RecorderService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/services/RecorderService.kt b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/services/RecorderService.kt index 09faac9..54ee0a6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/services/RecorderService.kt +++ b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/services/RecorderService.kt @@ -79,7 +79,7 @@ class RecorderService : Service() { try { if (!isQPlus() && isPathOnSD(currFilePath)) { var document = getDocumentFile(currFilePath.getParentPath()) - document = document?.createFile("", currFilePath.substring(currFilePath.lastIndexOf('/') + 1)) + document = document?.createFile("", currFilePath.getFilenameFromPath()) val outputFileDescriptor = contentResolver.openFileDescriptor(document!!.uri, "w")!!.fileDescriptor setOutputFile(outputFileDescriptor)