Mercurial > minori
comparison src/track/types.cc @ 135:0a458cb26ff4
filesystem: move to using std::filesystem after C++17 switch
old compilers will croak compiling this, but it's not like we
*really* need to support them (they probably croak compiling
Qt as well)
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Thu, 09 Nov 2023 18:01:56 -0500 |
| parents | 39521c47c7a3 |
| children |
comparison
equal
deleted
inserted
replaced
| 134:54c9d36207db | 135:0a458cb26ff4 |
|---|---|
| 193 }; | 193 }; |
| 194 | 194 |
| 195 void LoadPlayers(std::vector<MediaPlayer>& players) { | 195 void LoadPlayers(std::vector<MediaPlayer>& players) { |
| 196 nlohmann::json json; | 196 nlohmann::json json; |
| 197 { | 197 { |
| 198 std::ifstream is(Filesystem::GetPlayersPath().GetPath()); | 198 std::ifstream is(Filesystem::GetPlayersPath().string()); |
| 199 if (!is.is_open()) | 199 if (!is.is_open()) |
| 200 json = default_players; | 200 json = default_players; |
| 201 else | 201 else |
| 202 is >> json; | 202 is >> json; |
| 203 } | 203 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 void LoadExtensions(std::vector<MediaExtension>& extensions) { | 215 void LoadExtensions(std::vector<MediaExtension>& extensions) { |
| 216 nlohmann::json json; | 216 nlohmann::json json; |
| 217 { | 217 { |
| 218 std::ifstream is(Filesystem::GetExtensionsPath().GetPath()); | 218 std::ifstream is(Filesystem::GetExtensionsPath().string()); |
| 219 if (!is.is_open()) | 219 if (!is.is_open()) |
| 220 json = default_extensions; | 220 json = default_extensions; |
| 221 else | 221 else |
| 222 is >> json; | 222 is >> json; |
| 223 } | 223 } |
| 240 {"enabled", player.GetEnabled()} | 240 {"enabled", player.GetEnabled()} |
| 241 }); | 241 }); |
| 242 } | 242 } |
| 243 | 243 |
| 244 { | 244 { |
| 245 std::ofstream os(Filesystem::GetPlayersPath().GetPath()); | 245 std::ofstream os(Filesystem::GetPlayersPath().string()); |
| 246 if (!os.is_open()) | 246 if (!os.is_open()) |
| 247 return; | 247 return; |
| 248 os << std::setw(4) << json << std::endl; | 248 os << std::setw(4) << json << std::endl; |
| 249 } | 249 } |
| 250 } | 250 } |
| 257 {"enabled", extension.GetEnabled()} | 257 {"enabled", extension.GetEnabled()} |
| 258 }); | 258 }); |
| 259 } | 259 } |
| 260 | 260 |
| 261 { | 261 { |
| 262 std::ofstream os(Filesystem::GetExtensionsPath().GetPath()); | 262 std::ofstream os(Filesystem::GetExtensionsPath().string()); |
| 263 if (!os.is_open()) | 263 if (!os.is_open()) |
| 264 return; | 264 return; |
| 265 os << std::setw(4) << json << std::endl; | 265 os << std::setw(4) << json << std::endl; |
| 266 } | 266 } |
| 267 } | 267 } |
