Проблема здесь - , даже если файл недоступен в упомянутом место К сожалению, это не сработало. < /p>
Код: Выделить всё
bool ClassName::loadRecordingConfiguration()
{
std::string filepathConfig = getDataFolder() + std::string("\\file.json");
std::ifstream jsonFile(filepathConfig.c_str());
if (jsonFile.is_open()) {
//This part is executed when getDataFolder failed to return the folder path and file.json is not available
//This part is also executed when getDataFolder returns correct folder path and file.json is available
}
}
//Returns the folder path if SomeCondition is satisfied
std::string ClassName::getDataFolder()
{
if (SomeCondition) {
return std::string(SomeFilePath);
}
return std::string("");
}
Подробнее здесь: https://stackoverflow.com/questions/554 ... e-location
Мобильная версия