Return specific error code for non writable filesystem

This commit is contained in:
UnknownShadow200 2025-10-11 07:39:42 +11:00
parent 2cbe56aaeb
commit fe76435079
6 changed files with 24 additions and 10 deletions

View File

@ -55,6 +55,18 @@ jobs:
SOURCE_FILE: 'SDK/epoc32/release/armv5/urel/ClassiCube_s60v3.exe'
DEST_NAME: 'ClassiCube_s60v3.exe'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'SDK/epoc32/release/armv5/urel/ClassiCube_s60v5.exe.sym'
DEST_NAME: 'ClassiCube_s60v5.elf'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'SDK/epoc32/release/armv5/urel/ClassiCube_s60v3.exe.sym'
DEST_NAME: 'ClassiCube_s60v3.elf'
- uses: ./.github/actions/notify_success
if: ${{ always() && steps.compile.outcome == 'success' }}

View File

@ -138,5 +138,6 @@ enum CC_ERRORS {
SSL_ERR_CONTEXT_DEAD = 0xCCDED070UL, /* Server shutdown the SSL context and it must be recreated */
PNG_ERR_16BITSAMPLES = 0xCCDED071UL, /* Image uses 16 bit samples, which is unimplemented */
ERR_NO_NETWORKING = 0xCCDED072UL, /* No working network connection */
ERR_NON_WRITABLE_FS = 0xCCDED073UL, /* No writable filesystem detected */
};
#endif

View File

@ -119,6 +119,7 @@ static const char* GetCCErrorDesc(cc_result res) {
case HTTP_ERR_NO_SSL: return "HTTPS URLs are not currently supported";
case SOCK_ERR_UNKNOWN_HOST: return "Host could not be resolved to an IP address";
case ERR_NO_NETWORKING: return "No working network access";
case ERR_NON_WRITABLE_FS: return "Non-writable filesystem";
}
return NULL;
}

View File

@ -94,7 +94,7 @@ void Platform_EncodePath(cc_filepath* dst, const cc_string* path) {
void Directory_GetCachePath(cc_string* path) { }
cc_result Directory_Create(const cc_filepath* path) {
if (!fat_available) return ENOSYS;
if (!fat_available) return ERR_NON_WRITABLE_FS;
return mkdir(path->buffer, 0) == -1 ? errno : 0;
}
@ -157,12 +157,12 @@ cc_result File_Open(cc_file* file, const cc_filepath* path) {
}
cc_result File_Create(cc_file* file, const cc_filepath* path) {
if (!fat_available) return ENOTSUP;
if (!fat_available) return ERR_NON_WRITABLE_FS;
return File_Do(file, path->buffer, O_RDWR | O_CREAT | O_TRUNC);
}
cc_result File_OpenOrCreate(cc_file* file, const cc_filepath* path) {
if (!fat_available) return ENOTSUP;
if (!fat_available) return ERR_NON_WRITABLE_FS;
return File_Do(file, path->buffer, O_RDWR | O_CREAT);
}

View File

@ -286,12 +286,12 @@ cc_result File_Open(cc_file* file, const cc_filepath* path) {
}
cc_result File_Create(cc_file* file, const cc_filepath* path) {
if (!fat_available) return ENOTSUP;
if (!fat_available) return ERR_NON_WRITABLE_FS;
return File_Do(file, path->buffer, O_RDWR | O_CREAT | O_TRUNC, "Create");
}
cc_result File_OpenOrCreate(cc_file* file, const cc_filepath* path) {
if (!fat_available) return ENOTSUP;
if (!fat_available) return ERR_NON_WRITABLE_FS;
return File_Do(file, path->buffer, O_RDWR | O_CREAT, "Update");
}

View File

@ -107,7 +107,7 @@ void Platform_EncodePath(cc_filepath* dst, const cc_string* path) {
void Directory_GetCachePath(cc_string* path) { }
cc_result Directory_Create(const cc_filepath* path) {
if (!fat_available) return ENOSYS;
if (!fat_available) return ERR_NON_WRITABLE_FS;
return mkdir(path->buffer, 0) == -1 ? errno : 0;
}
@ -170,12 +170,12 @@ cc_result File_Open(cc_file* file, const cc_filepath* path) {
}
cc_result File_Create(cc_file* file, const cc_filepath* path) {
if (!fat_available) return ENOTSUP;
if (!fat_available) return ERR_NON_WRITABLE_FS;
return File_Do(file, path->buffer, O_RDWR | O_CREAT | O_TRUNC);
}
cc_result File_OpenOrCreate(cc_file* file, const cc_filepath* path) {
if (!fat_available) return ENOTSUP;
if (!fat_available) return ERR_NON_WRITABLE_FS;
return File_Do(file, path->buffer, O_RDWR | O_CREAT);
}