| 103 | | const fs::path snx_lib_dir = snx_base_dir / "lib64"; |
|---|
| 104 | | #else |
|---|
| 105 | | const fs::path snx_lib_dir = snx_base_dir / "lib"; |
|---|
| 106 | | #endif |
|---|
| | 107 | const fs::path snx_lib_dir = snx_base_dir / "lib64"; |
|---|
| | 108 | #else |
|---|
| | 109 | const fs::path snx_lib_dir = snx_base_dir / "lib"; |
|---|
| | 110 | #endif |
|---|
| | 111 | |
|---|
| | 112 | const std::string sonix_subdir_base("sonix"); |
|---|
| | 113 | |
|---|
| | 114 | // If versioning is enabled, then the name of the directory containing |
|---|
| | 115 | // the Sonix plug-ins must contain version information. |
|---|
| | 116 | #if defined(SNX_USE_VERSIONING) |
|---|
| | 117 | std::string sonix_ver_str; |
|---|
| | 118 | const std::string sonix_version("SNX_VERSION"); |
|---|
| | 119 | |
|---|
| | 120 | // If $SNX_VERSION is set, use the value of that environment variable |
|---|
| | 121 | // as the version component of the plug-in subdirectory name. Otherwise, |
|---|
| | 122 | // use the compile-time value provided by SNX_VERSION_DOT. |
|---|
| | 123 | if ( ! vpr::System::getenv(sonix_version, sonix_ver_str) ) |
|---|
| | 124 | { |
|---|
| | 125 | sonix_ver_str = SNX_VERSION_DOT; |
|---|
| | 126 | } |
|---|
| | 127 | |
|---|
| | 128 | fs::path sonix_subdir( |
|---|
| | 129 | snx_lib_dir / (sonix_subdir_base + "-" + sonix_ver_str) / "plugins" |
|---|
| | 130 | ); |
|---|
| | 131 | |
|---|
| | 132 | // If versioning is not enabled, then the directory containing the |
|---|
| | 133 | // Sonix plug-ins will not incorporate version information. |
|---|
| | 134 | #else |
|---|
| | 135 | fs::path sonix_subdir(snx_lib_dir / sonix_subdir_base / "plugins"); |
|---|
| | 136 | #endif |
|---|
| | 137 | |
|---|
| | 138 | #if defined(SNX_DEBUG) |
|---|
| | 139 | #if defined(_DEBUG) |
|---|
| | 140 | sonix_subdir /= "dbgrt"; |
|---|
| | 141 | #else |
|---|
| | 142 | sonix_subdir /= "dbg"; |
|---|
| | 143 | #endif |
|---|
| | 144 | #else |
|---|
| | 145 | sonix_subdir /= "opt"; |
|---|
| | 146 | #endif |
|---|
| | 147 | |
|---|
| | 148 | search_paths.push_back(sonix_subdir); |
|---|
| | 149 | |
|---|
| | 150 | std::string home_dir; |
|---|
| | 151 | if ( vpr::System::getenv("HOME", home_dir) ) |
|---|
| | 152 | { |
|---|
| | 153 | search_paths.push_back( |
|---|
| | 154 | fs::path(home_dir, fs::native) / fs::path(".sonix", fs::native) / |
|---|
| | 155 | "plugins" |
|---|
| | 156 | ); |
|---|
| | 157 | } |
|---|
| | 158 | } |
|---|
| | 159 | catch (fs::filesystem_error& ex) |
|---|
| | 160 | { |
|---|
| | 161 | vprDEBUG(snxDBG, vprDBG_WARNING_LVL) |
|---|
| | 162 | << clrOutNORM(clrRED, "WARNING") |
|---|
| | 163 | << ": File system exception caught while constructing search " |
|---|
| | 164 | << "path: " << std::endl << ex.what() << std::endl |
|---|
| | 165 | << vprDEBUG_FLUSH; |
|---|
| | 166 | } |
|---|
| 115 | | |
|---|
| 116 | | const std::string sonix_subdir_base("sonix"); |
|---|
| 117 | | |
|---|
| 118 | | // If versioning is enabled, then the name of the directory containing the |
|---|
| 119 | | // Sonix plug-ins must contain version information. |
|---|
| 120 | | #if defined(SNX_USE_VERSIONING) |
|---|
| 121 | | std::string sonix_ver_str; |
|---|
| 122 | | const std::string sonix_version("SNX_VERSION"); |
|---|
| 123 | | |
|---|
| 124 | | // If $SNX_VERSION is set, use the value of that environment variable |
|---|
| 125 | | // as the version component of the plug-in subdirectory name. Otherwise, |
|---|
| 126 | | // use the compile-time value provided by SNX_VERSION_DOT. |
|---|
| 127 | | if ( ! vpr::System::getenv(sonix_version, sonix_ver_str) ) |
|---|
| 128 | | { |
|---|
| 129 | | sonix_ver_str = SNX_VERSION_DOT; |
|---|
| 130 | | } |
|---|
| 131 | | |
|---|
| 132 | | fs::path sonix_subdir( |
|---|
| 133 | | snx_lib_dir / (sonix_subdir_base + "-" + sonix_ver_str) / "plugins" |
|---|
| 134 | | ); |
|---|
| 135 | | |
|---|
| 136 | | // If versioning is not enabled, then the directory containing the |
|---|
| 137 | | // Sonix plug-ins will not incorporate version information. |
|---|
| 138 | | #else |
|---|
| 139 | | fs::path sonix_subdir(snx_lib_dir / sonix_subdir_base / "plugins"); |
|---|
| 140 | | #endif |
|---|
| 141 | | |
|---|
| 142 | | #if defined(SNX_DEBUG) |
|---|
| 143 | | #if defined(_DEBUG) |
|---|
| 144 | | sonix_subdir /= "dbgrt"; |
|---|
| 145 | | #else |
|---|
| 146 | | sonix_subdir /= "dbg"; |
|---|
| 147 | | #endif |
|---|
| 148 | | #else |
|---|
| 149 | | sonix_subdir /= "opt"; |
|---|
| 150 | | #endif |
|---|
| 151 | | |
|---|
| 152 | | std::vector<fs::path> search_paths; |
|---|
| 153 | | search_paths.push_back(sonix_subdir); |
|---|
| 154 | | |
|---|
| 155 | | std::string home_dir; |
|---|
| 156 | | if ( vpr::System::getenv("HOME", home_dir) ) |
|---|
| 157 | | { |
|---|
| 158 | | search_paths.push_back( |
|---|
| 159 | | fs::path(home_dir, fs::native) / ".sonix" / "plugins" |
|---|
| 160 | | ); |
|---|
| 161 | | } |
|---|