From 23d3bfe3e2001cceb38ac0268d0b18a579d39edd Mon Sep 17 00:00:00 2001 From: jules Date: Sun, 28 Sep 2014 13:15:01 +0100 Subject: [PATCH] Bit of minor cleaning up. --- .../juce_core/native/juce_posix_SharedCode.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index d30ef83986..91785d6ad7 100644 --- a/modules/juce_core/native/juce_posix_SharedCode.h +++ b/modules/juce_core/native/juce_posix_SharedCode.h @@ -223,6 +223,12 @@ namespace return statfs (f.getFullPathName().toUTF8(), &result) == 0; } + #if (JUCE_MAC && MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5) || JUCE_IOS + static int64 getCreationTime (const juce_statStruct& s) noexcept { return (int64) s.st_birthtime; } + #else + static int64 getCreationTime (const juce_statStruct& s) noexcept { return (int64) s.st_ctime; } + #endif + void updateStatInfoForFile (const String& path, bool* const isDir, int64* const fileSize, Time* const modTime, Time* const creationTime, bool* const isReadOnly) { @@ -232,15 +238,9 @@ namespace const bool statOk = juce_stat (path, info); if (isDir != nullptr) *isDir = statOk && ((info.st_mode & S_IFDIR) != 0); - if (fileSize != nullptr) *fileSize = statOk ? info.st_size : 0; - if (modTime != nullptr) *modTime = Time (statOk ? (int64) info.st_mtime * 1000 : 0); - - if (creationTime != nullptr) *creationTime = Time ((! statOk) ? 0 : (int64) (1000 * - #if (JUCE_MAC || JUCE_IOS) && MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 - info.st_birthtime)); - #else - info.st_ctime)); - #endif + if (fileSize != nullptr) *fileSize = statOk ? (int64) info.st_size : 0; + if (modTime != nullptr) *modTime = Time (statOk ? (int64) info.st_mtime * 1000 : 0); + if (creationTime != nullptr) *creationTime = Time (statOk ? getCreationTime (info) * 1000 : 0); } if (isReadOnly != nullptr)