From 058d5b95742e76f90567d70e3c47a275f5c129c1 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 20 Jan 2009 10:43:31 +0000 Subject: [PATCH] Implemented File::isOnRemovableDrive() for mac --- .../platform_specific_code/juce_mac_Files.mm | 14 ++++++++++++-- juce_amalgamated.cpp | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/build/macosx/platform_specific_code/juce_mac_Files.mm b/build/macosx/platform_specific_code/juce_mac_Files.mm index eeaba4762a..1eaddaa635 100644 --- a/build/macosx/platform_specific_code/juce_mac_Files.mm +++ b/build/macosx/platform_specific_code/juce_mac_Files.mm @@ -204,8 +204,18 @@ bool File::isOnHardDisk() const throw() bool File::isOnRemovableDrive() const throw() { - jassertfalse // xxx not implemented for mac! - return false; + const ScopedAutoReleasePool pool; + BOOL removable = false; + + [[NSWorkspace sharedWorkspace] + getFileSystemInfoForPath: juceStringToNS (getFullPathName()) + isRemovable: &removable + isWritable: nil + isUnmountable: nil + description: nil + type: nil]; + + return removable; } static bool juce_isHiddenFile (const String& path) throw() diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 82f6b68ba3..db2495922f 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -264539,8 +264539,18 @@ bool File::isOnHardDisk() const throw() bool File::isOnRemovableDrive() const throw() { - jassertfalse // xxx not implemented for mac! - return false; + const ScopedAutoReleasePool pool; + BOOL removable = false; + + [[NSWorkspace sharedWorkspace] + getFileSystemInfoForPath: juceStringToNS (getFullPathName()) + isRemovable: &removable + isWritable: nil + isUnmountable: nil + description: nil + type: nil]; + + return removable; } static bool juce_isHiddenFile (const String& path) throw()