shell_ios.m 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * WinPR: Windows Portable Runtime
  3. * Path Functions
  4. *
  5. * Copyright 2016 Armin Novak <armin.novak@thincast.om>
  6. * Copyright 2016 Thincast Technologies GmbH
  7. *
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. #import <Foundation/Foundation.h>
  21. #ifdef HAVE_CONFIG_H
  22. #include "config.h"
  23. #endif
  24. #include "shell_ios.h"
  25. NSString *ios_get_directory_for_search_path(NSString *searchPath)
  26. {
  27. return [NSSearchPathForDirectoriesInDomains(searchPath, NSUserDomainMask, YES) lastObject];
  28. }
  29. char *ios_get_home(void)
  30. {
  31. NSString *path = ios_get_directory_for_search_path(NSDocumentDirectory);
  32. return strdup([path UTF8String]);
  33. }
  34. char *ios_get_temp(void)
  35. {
  36. NSString *tmp_path = NSTemporaryDirectory();
  37. return strdup([tmp_path UTF8String]);
  38. }
  39. char *ios_get_data(void)
  40. {
  41. NSString *path = ios_get_directory_for_search_path(NSApplicationSupportDirectory);
  42. return strdup([path UTF8String]);
  43. }
  44. char *ios_get_cache(void)
  45. {
  46. NSString *path = ios_get_directory_for_search_path(NSCachesDirectory);
  47. return strdup([path UTF8String]);
  48. }