Skip to content

Commit 474354d

Browse files
cilpsReenigneArcher
authored andcommitted
refactor(api) std::filesystem::path to fs::path
Used the shorter fs::path alias instead of std::filesystem::path. Also removed unnecesary path conversion.
1 parent 25239a5 commit 474354d

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/confighttp.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ namespace confighttp {
288288
* @brief Validates a path whether it is a valid png.
289289
* @param path The path to the png file.
290290
*/
291-
bool check_valid_png(std::filesystem::path path) {
291+
bool check_valid_png(fs::path path) {
292292
// PNG signature as defined in PNG specification
293293
// http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html
294294
static constexpr std::array<unsigned char, 8> PNG_SIGNATURE = {
@@ -1011,18 +1011,18 @@ namespace confighttp {
10111011
return;
10121012
}
10131013

1014-
std::filesystem::path path = app["image-path"];
1014+
fs::path path = app["image-path"];
10151015

1016-
const std::filesystem::path coverdir = platf::appdata().string() + "/covers/";
1017-
if (std::filesystem::exists(coverdir / path)) {
1016+
const fs::path coverdir = platf::appdata().string() + "/covers/";
1017+
if (fs::exists(coverdir / path)) {
10181018
path = coverdir / path;
10191019
}
10201020

1021-
if (std::filesystem::exists(platf::appdata() / path)) {
1021+
if (fs::exists(platf::appdata() / path)) {
10221022
path = platf::appdata().string() / path;
10231023
}
10241024

1025-
if (!std::filesystem::exists(path) || fs::path(path).extension() != ".png") {
1025+
if (!fs::exists(path) || path.extension() != ".png") {
10261026
not_found(response, request, "'image-path' not set or does not have a 'png' file extension");
10271027
return;
10281028
}

0 commit comments

Comments
 (0)