mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-03 09:02:30 +00:00
Fix HasFile and HasDirectory
This commit is contained in:
parent
1cd8ac2bb2
commit
80d1ec57d1
2 changed files with 10 additions and 5 deletions
|
@ -127,8 +127,9 @@ namespace sts::ncm {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContentStorageInterface::HasPlaceHolder(Out<bool> out, PlaceHolderId placeholder_id) {
|
Result ContentStorageInterface::HasPlaceHolder(Out<bool> out, PlaceHolderId placeholder_id) {
|
||||||
if (this->disabled)
|
if (this->disabled) {
|
||||||
return ResultNcmInvalidContentStorage;
|
return ResultNcmInvalidContentStorage;
|
||||||
|
}
|
||||||
|
|
||||||
char placeholder_path[FS_MAX_PATH] = {0};
|
char placeholder_path[FS_MAX_PATH] = {0};
|
||||||
this->placeholder_accessor.GetPlaceHolderPath(placeholder_path, placeholder_id);
|
this->placeholder_accessor.GetPlaceHolderPath(placeholder_path, placeholder_id);
|
||||||
|
|
|
@ -25,12 +25,14 @@ namespace sts::ncm {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
*out = false;
|
|
||||||
if (stat(path, &st) == 0 && S_ISREG(st.st_mode)) {
|
if (stat(path, &st) == 0 && S_ISREG(st.st_mode)) {
|
||||||
*out = true;
|
*out = true;
|
||||||
|
} else {
|
||||||
|
*out = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errno != 0) {
|
/* It is a valid state for the file to not exist. */
|
||||||
|
if (errno != 0 && errno != ENOENT && errno != ENOTDIR) {
|
||||||
return fsdevGetLastResult();
|
return fsdevGetLastResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,12 +43,14 @@ namespace sts::ncm {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
*out = false;
|
|
||||||
if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) {
|
if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) {
|
||||||
*out = true;
|
*out = true;
|
||||||
|
} else {
|
||||||
|
*out = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errno != 0) {
|
/* It is a valid state for the directory to not exist. */
|
||||||
|
if (errno != 0 && errno != ENOENT && errno != ENOTDIR) {
|
||||||
return fsdevGetLastResult();
|
return fsdevGetLastResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue