@@ -13,11 +13,12 @@ fmod_manager::~fmod_manager()
1313 CoUninitialize ();
1414}
1515
16- bool fmod_manager::load_selected_bank (const std::string & plugin_files_dir)
16+ bool fmod_manager::load_selected_bank (const std::filesystem::path & plugin_files_dir)
1717{
18- const auto selected_bank_file_path = plugin_files_dir + " selected.bank.txt" ;
18+ auto selected_bank_file_path = plugin_files_dir;
19+ selected_bank_file_path.append (" selected.bank.txt" );
1920
20- if (!fs:: exists (selected_bank_file_path))
21+ if (!exists (selected_bank_file_path))
2122 {
2223 scs_log_ (SCS_LOG_TYPE_error, " [ts-fmod-plugin] Could not find the 'selected.bank.txt' file" );
2324 return false ;
@@ -35,9 +36,13 @@ bool fmod_manager::load_selected_bank(const std::string& plugin_files_dir)
3536 int i = 0 ;
3637 while (selected_bank_file >> bank_name)
3738 {
38- const auto res = system_->loadBankFile ((plugin_files_dir + bank_name + " .bank" ).c_str (),
39- FMOD_STUDIO_LOAD_BANK_NORMAL,
40- &bank);
39+ auto bank_file_path = plugin_files_dir;
40+ bank_file_path.append (bank_name).concat (" .bank" );
41+
42+ const auto res = system_->loadBankFile (
43+ bank_file_path.generic_u8string ().c_str (),
44+ FMOD_STUDIO_LOAD_BANK_NORMAL,
45+ &bank);
4146 if (res != FMOD_OK)
4247 {
4348 std::stringstream ss;
@@ -63,8 +68,7 @@ bool fmod_manager::init()
6368 scs_log_ (SCS_LOG_TYPE_error, " [ts-fmod-plugin] CoInitializeEx Failed" );
6469 return false ;
6570 }
66-
67- auto plugin_files_dir = fs::current_path ().generic_u8string () + " /plugins/ts-fmod-plugin/" ;
71+ const auto plugin_files_dir = fs::current_path ().append (" plugins/ts-fmod-plugin" );
6872 auto res = FMOD::Studio::System::create (&system_);
6973 if (res != FMOD_OK)
7074 {
@@ -114,9 +118,13 @@ bool fmod_manager::init()
114118
115119 FMOD::Studio::Bank* bank;
116120
117- res = system_->loadBankFile ((plugin_files_dir + " master.bank" ).c_str (),
121+ auto master_bank_path = plugin_files_dir;
122+ master_bank_path.append (" master.bank" );
123+
124+ res = system_->loadBankFile (master_bank_path.generic_u8string ().c_str (),
118125 FMOD_STUDIO_LOAD_BANK_NORMAL,
119126 &bank);
127+
120128 if (res != FMOD_OK)
121129 {
122130 std::stringstream ss;
@@ -166,15 +174,18 @@ bool fmod_manager::init()
166174 return true ;
167175}
168176
169- bool fmod_manager::init_channels (const std::string & plugin_files_dir)
177+ bool fmod_manager::init_channels (const std::filesystem::path & plugin_files_dir)
170178{
171179 for (const std::string& bank_name : selected_bank_names_)
172180 {
173181 std::stringstream ss;
174182 ss << " [ts-fmod-plugin] Loading the events and busses for '" << bank_name << " '" ;
175183 scs_log_ (SCS_LOG_TYPE_message, ss.str ().c_str ());
176- auto guids_file_path = plugin_files_dir + bank_name + " .bank.guids" ;
177- if (!fs::exists (guids_file_path))
184+
185+ auto guids_file_path = plugin_files_dir;
186+ guids_file_path.append (bank_name).concat (" .bank.guids" );
187+
188+ if (!exists (guids_file_path))
178189 {
179190 scs_log_ (SCS_LOG_TYPE_error, " [ts-fmod-plugin] Could not find the '*.bank.guids' file" );
180191 return false ;
@@ -261,11 +272,11 @@ float fmod_manager::get_sound_level_from_json(json j, const char* key, float def
261272 return val / 2 ;
262273}
263274
264- bool fmod_manager::load_sound_levels (const std::string& plugin_files_dir)
275+ bool fmod_manager::load_sound_levels (std::filesystem::path plugin_files_dir)
265276{
266- const auto sound_levels_file_path = plugin_files_dir + " sound_levels.txt" ;
277+ const auto sound_levels_file_path = plugin_files_dir. append ( " sound_levels.txt" ) ;
267278
268- if (!fs:: exists (sound_levels_file_path))
279+ if (!exists (sound_levels_file_path))
269280 {
270281 scs_log_ (SCS_LOG_TYPE_error, " [ts-fmod-plugin] Could not find the 'sound_levels.txt' file" );
271282 return false ;
0 commit comments