find_directory.odin 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. //+build haiku
  2. package sys_haiku
  3. import "core:c"
  4. directory_which :: enum c.int {
  5. // Per volume directories
  6. DESKTOP_DIRECTORY = 0,
  7. TRASH_DIRECTORY,
  8. // System directories
  9. SYSTEM_DIRECTORY = 1000,
  10. SYSTEM_ADDONS_DIRECTORY = 1002,
  11. SYSTEM_BOOT_DIRECTORY,
  12. SYSTEM_FONTS_DIRECTORY,
  13. SYSTEM_LIB_DIRECTORY,
  14. SYSTEM_SERVERS_DIRECTORY,
  15. SYSTEM_APPS_DIRECTORY,
  16. SYSTEM_BIN_DIRECTORY,
  17. SYSTEM_DOCUMENTATION_DIRECTORY = 1010,
  18. SYSTEM_PREFERENCES_DIRECTORY,
  19. SYSTEM_TRANSLATORS_DIRECTORY,
  20. SYSTEM_MEDIA_NODES_DIRECTORY,
  21. SYSTEM_SOUNDS_DIRECTORY,
  22. SYSTEM_DATA_DIRECTORY,
  23. SYSTEM_DEVELOP_DIRECTORY,
  24. SYSTEM_PACKAGES_DIRECTORY,
  25. SYSTEM_HEADERS_DIRECTORY,
  26. SYSTEM_ETC_DIRECTORY = 2008,
  27. SYSTEM_SETTINGS_DIRECTORY = 2010,
  28. SYSTEM_LOG_DIRECTORY = 2012,
  29. SYSTEM_SPOOL_DIRECTORY,
  30. SYSTEM_TEMP_DIRECTORY,
  31. SYSTEM_VAR_DIRECTORY,
  32. SYSTEM_CACHE_DIRECTORY = 2020,
  33. SYSTEM_NONPACKAGED_DIRECTORY = 2023,
  34. SYSTEM_NONPACKAGED_ADDONS_DIRECTORY,
  35. SYSTEM_NONPACKAGED_TRANSLATORS_DIRECTORY,
  36. SYSTEM_NONPACKAGED_MEDIA_NODES_DIRECTORY,
  37. SYSTEM_NONPACKAGED_BIN_DIRECTORY,
  38. SYSTEM_NONPACKAGED_DATA_DIRECTORY,
  39. SYSTEM_NONPACKAGED_FONTS_DIRECTORY,
  40. SYSTEM_NONPACKAGED_SOUNDS_DIRECTORY,
  41. SYSTEM_NONPACKAGED_DOCUMENTATION_DIRECTORY,
  42. SYSTEM_NONPACKAGED_LIB_DIRECTORY,
  43. SYSTEM_NONPACKAGED_HEADERS_DIRECTORY,
  44. SYSTEM_NONPACKAGED_DEVELOP_DIRECTORY,
  45. // User directories. These are interpreted in the context of the user making the find_directory call.
  46. USER_DIRECTORY = 3000,
  47. USER_CONFIG_DIRECTORY,
  48. USER_ADDONS_DIRECTORY,
  49. USER_BOOT_DIRECTORY,
  50. USER_FONTS_DIRECTORY,
  51. USER_LIB_DIRECTORY,
  52. USER_SETTINGS_DIRECTORY,
  53. USER_DESKBAR_DIRECTORY,
  54. USER_PRINTERS_DIRECTORY,
  55. USER_TRANSLATORS_DIRECTORY,
  56. USER_MEDIA_NODES_DIRECTORY,
  57. USER_SOUNDS_DIRECTORY,
  58. USER_DATA_DIRECTORY,
  59. USER_CACHE_DIRECTORY,
  60. USER_PACKAGES_DIRECTORY,
  61. USER_HEADERS_DIRECTORY,
  62. USER_NONPACKAGED_DIRECTORY,
  63. USER_NONPACKAGED_ADDONS_DIRECTORY,
  64. USER_NONPACKAGED_TRANSLATORS_DIRECTORY,
  65. USER_NONPACKAGED_MEDIA_NODES_DIRECTORY,
  66. USER_NONPACKAGED_BIN_DIRECTORY,
  67. USER_NONPACKAGED_DATA_DIRECTORY,
  68. USER_NONPACKAGED_FONTS_DIRECTORY,
  69. USER_NONPACKAGED_SOUNDS_DIRECTORY,
  70. USER_NONPACKAGED_DOCUMENTATION_DIRECTORY,
  71. USER_NONPACKAGED_LIB_DIRECTORY,
  72. USER_NONPACKAGED_HEADERS_DIRECTORY,
  73. USER_NONPACKAGED_DEVELOP_DIRECTORY,
  74. USER_DEVELOP_DIRECTORY,
  75. USER_DOCUMENTATION_DIRECTORY,
  76. USER_SERVERS_DIRECTORY,
  77. USER_APPS_DIRECTORY,
  78. USER_BIN_DIRECTORY,
  79. USER_PREFERENCES_DIRECTORY,
  80. USER_ETC_DIRECTORY,
  81. USER_LOG_DIRECTORY,
  82. USER_SPOOL_DIRECTORY,
  83. USER_VAR_DIRECTORY,
  84. // Global directories
  85. APPS_DIRECTORY = 4000,
  86. PREFERENCES_DIRECTORY,
  87. UTILITIES_DIRECTORY,
  88. PACKAGE_LINKS_DIRECTORY,
  89. // Obsolete: Legacy BeOS definition to be phased out
  90. BEOS_DIRECTORY = 1000,
  91. BEOS_SYSTEM_DIRECTORY,
  92. BEOS_ADDONS_DIRECTORY,
  93. BEOS_BOOT_DIRECTORY,
  94. BEOS_FONTS_DIRECTORY,
  95. BEOS_LIB_DIRECTORY,
  96. BEOS_SERVERS_DIRECTORY,
  97. BEOS_APPS_DIRECTORY,
  98. BEOS_BIN_DIRECTORY,
  99. BEOS_ETC_DIRECTORY,
  100. BEOS_DOCUMENTATION_DIRECTORY,
  101. BEOS_PREFERENCES_DIRECTORY,
  102. BEOS_TRANSLATORS_DIRECTORY,
  103. BEOS_MEDIA_NODES_DIRECTORY,
  104. BEOS_SOUNDS_DIRECTORY,
  105. }
  106. find_path_flags :: enum c.int {
  107. CREATE_DIRECTORY = 0x0001,
  108. CREATE_PARENT_DIRECTORY = 0x0002,
  109. EXISTING_ONLY = 0x0004,
  110. // find_paths() only!
  111. SYSTEM_ONLY = 0x0010,
  112. USER_ONLY = 0x0020,
  113. }
  114. path_base_directory :: enum c.int {
  115. INSTALLATION_LOCATION_DIRECTORY,
  116. ADD_ONS_DIRECTORY,
  117. APPS_DIRECTORY,
  118. BIN_DIRECTORY,
  119. BOOT_DIRECTORY,
  120. CACHE_DIRECTORY,
  121. DATA_DIRECTORY,
  122. DEVELOP_DIRECTORY,
  123. DEVELOP_LIB_DIRECTORY,
  124. DOCUMENTATION_DIRECTORY,
  125. ETC_DIRECTORY,
  126. FONTS_DIRECTORY,
  127. HEADERS_DIRECTORY,
  128. LIB_DIRECTORY,
  129. LOG_DIRECTORY,
  130. MEDIA_NODES_DIRECTORY,
  131. PACKAGES_DIRECTORY,
  132. PREFERENCES_DIRECTORY,
  133. SERVERS_DIRECTORY,
  134. SETTINGS_DIRECTORY,
  135. SOUNDS_DIRECTORY,
  136. SPOOL_DIRECTORY,
  137. TRANSLATORS_DIRECTORY,
  138. VAR_DIRECTORY,
  139. // find_path() only!
  140. IMAGE_PATH = 1000,
  141. PACKAGE_PATH,
  142. }
  143. // value that can be used instead of a pointer to a symbol in the program image
  144. APP_IMAGE_SYMBOL :: rawptr(addr_t(0))
  145. // pointer to a symbol in the callers image (same as B_CURRENT_IMAGE_SYMBOL)
  146. current_image_symbol :: proc() -> rawptr { return rawptr(current_image_symbol) }
  147. foreign import libroot "system:c"
  148. foreign libroot {
  149. find_directory :: proc(which: directory_which, volume: dev_t, createIt: bool, pathString: [^]c.char, length: i32) -> status_t ---
  150. find_path :: proc(codePointer: rawptr, baseDirectory: path_base_directory, subPath: cstring, pathBuffer: [^]c.char, bufferSize: c.size_t) -> status_t ---
  151. find_path_etc :: proc(codePointer: rawptr, dependency: cstring, architecture: cstring, baseDirectory: path_base_directory, subPath: cstring, flags: find_path_flags, pathBuffer: [^]c.char, bufferSize: c.size_t) -> status_t ---
  152. find_path_for_path :: proc(path: cstring, baseDirectory: path_base_directory, subPath: cstring, pathBuffer: [^]c.char, bufferSize: c.size_t) -> status_t ---
  153. find_path_for_path_etc :: proc(path: cstring, dependency: cstring, architecture: cstring, baseDirectory: path_base_directory, subPath: cstring, flags: find_path_flags, pathBuffer: [^]c.char, bufferSize: c.size_t) -> status_t ---
  154. find_paths :: proc(baseDirectory: path_base_directory, subPath: cstring, _paths: ^[^][^]c.char, _pathCount: ^c.size_t) -> status_t ---
  155. find_paths_etc :: proc(architecture: cstring, baseDirectory: path_base_directory, subPath: cstring, flags: find_path_flags, _paths: ^[^][^]c.char, _pathCount: ^c.size_t) -> status_t ---
  156. }