From f0ada66b0f022b397e525ea0ff7e7f1301cfc40b Mon Sep 17 00:00:00 2001 From: Lukasz Kozakiewicz Date: Tue, 29 Aug 2017 15:02:05 +0100 Subject: [PATCH] Android: ensure that temp directory exists before returning a path to it. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes “no such file or directory” error when calling open() for a file for which parent directory does not exist. --- modules/juce_core/native/juce_android_Files.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/juce_core/native/juce_android_Files.cpp b/modules/juce_core/native/juce_android_Files.cpp index 2b8f7ea998..41f8ec5f66 100644 --- a/modules/juce_core/native/juce_android_Files.cpp +++ b/modules/juce_core/native/juce_android_Files.cpp @@ -105,7 +105,11 @@ File File::getSpecialLocation (const SpecialLocationType type) return File ("/system/app"); case tempDirectory: - return File (android.appDataDir).getChildFile (".temp"); + { + File tmp = File (android.appDataDir).getChildFile (".temp"); + tmp.createDirectory(); + return File (tmp.getFullPathName()); + } case invokedExecutableFile: case currentExecutableFile: