PageRenderTime 24ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/core/externals/google-toolbox-for-mac/Foundation/GTMNSFileManager+Path.h

http://macfuse.googlecode.com/
C Header | 75 lines | 11 code | 9 blank | 55 comment | 1 complexity | 42b8efc2242d4e0219c0d3be92df0311 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, GPL-2.0
  1. //
  2. // GTMNSFileManager+Path.h
  3. //
  4. // Copyright 2006-2008 Google Inc.
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License"); you may not
  7. // use this file except in compliance with the License. You may obtain a copy
  8. // of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  14. // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  15. // License for the specific language governing permissions and limitations under
  16. // the License.
  17. //
  18. #import <Foundation/Foundation.h>
  19. /// A few useful methods for dealing with paths.
  20. @interface NSFileManager (GMFileManagerPathAdditions)
  21. #if GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
  22. /// For the Unix-y at heart, this is "mkdir -p". It tries to create
  23. /// the directory specified by |path|, and any intervening directories that
  24. /// are needed. Each directory that is created is created with |attributes|
  25. /// (see other NSFileManager doco for the details on |attributes|).
  26. ///
  27. /// If you are building for 10.5 or later, you should just use the new api:
  28. /// createDirectoryAtPath:withIntermediateDirectories:attributes:error:
  29. ///
  30. /// Also if you need more control over the creation of paths and their
  31. /// attributes, look into using GTMPath.
  32. ///
  33. /// Args:
  34. /// path - the path of the directory to create.
  35. /// attributes - these are defined in the "Constants" section of Apple's
  36. /// NSFileManager doco
  37. ///
  38. /// Returns:
  39. /// YES if |path| exists or was able to be created successfully
  40. /// NO otherwise
  41. ///
  42. - (BOOL)gtm_createFullPathToDirectory:(NSString *)path
  43. attributes:(NSDictionary *)attributes;
  44. #endif // GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
  45. /// Return an the paths for all resources in |directoryPath| that have the
  46. /// |extension| file extension.
  47. ///
  48. /// Args:
  49. /// extension - the file extension (excluding the leading ".") to match.
  50. /// If nil, all files are matched.
  51. /// directoryPath - the directory to look in. NOTE: Subdirectories are NOT
  52. /// traversed.
  53. ///
  54. /// Returns:
  55. /// An NSArray of absolute file paths that have |extension|. nil is returned
  56. /// if |directoryPath| doesn't exist or can't be opened, and returns an empty
  57. /// array if |directoryPath| is empty. ".", "..", and resource forks are never returned.
  58. ///
  59. - (NSArray *)gtm_filePathsWithExtension:(NSString *)extension
  60. inDirectory:(NSString *)directoryPath;
  61. /// Same as -filePathsWithExtension:inDirectory: except |extensions| is an
  62. /// NSArray of extensions to match.
  63. ///
  64. - (NSArray *)gtm_filePathsWithExtensions:(NSArray *)extensions
  65. inDirectory:(NSString *)directoryPath;
  66. @end