コード例 #1
0
DECL(int, FSGetFreeSpaceSizeAsync, void *pClient, void *pCmd, const char *path, uint64_t *returnedFreeSize, int error, void *asyncParams) {
    int client = GetCurClient(pClient);
    if (client != -1) {
        // log
        //fs_log_string(bss.socket_fs[client], path, BYTE_REMOVE);
        char buffer[200];
        __os_snprintf(buffer, sizeof(buffer), "FSGetFreeSpaceSizeAsync: %s", path);
        fs_log_string(bss.global_sock, buffer, BYTE_LOG_STR);

        // change path if it is a save folder
        int pathType = getPathType(path);
        if (pathType == PATH_TYPE_SAVE) {
            int len = strlen(path);
            int len_base = getNewPathLen(pathType);
            char new_path[len + len_base + 1];
            compute_new_path(new_path, path, len, pathType);

            // log new path
            fs_log_string(bss.socket_fs[client], new_path, BYTE_LOG_STR);

            return real_FSGetFreeSpaceSizeAsync(pClient, pCmd, new_path, returnedFreeSize, error, asyncParams);
        }
    }
    return real_FSGetFreeSpaceSizeAsync(pClient, pCmd, path, returnedFreeSize, error, asyncParams);
}
コード例 #2
0
ファイル: fs.c プロジェクト: Joonie86/loadiine
DECL(int, FSGetFreeSpaceSizeAsync, void *pClient, void *pCmd, char *path, uint64_t *returnedFreeSize, int error, FSAsyncParams *asyncParams) {
    int client = GetCurClient(pClient);
    if (client != -1) {
        // log
        //log_string(bss.socket_fs[client], path, BYTE_REMOVE);
        char buffer[200];
        __os_snprintf(buffer, sizeof(buffer), "FSGetFreeSpaceSizeAsync: %s", path);
        log_string(bss.global_sock, buffer, BYTE_LOG_STR);

        // change path if it is a save folder
        if (is_savefile(path)) {
            int len = strlen(path);
            int len_base = (strlen(bss.save_base) + 8);
            char new_path[len + len_base + 1];
            compute_new_path(new_path, path, len, 1);

            // log new path
            log_string(bss.socket_fs[client], new_path, BYTE_LOG_STR);

            return real_FSGetFreeSpaceSizeAsync(pClient, pCmd, new_path, returnedFreeSize, error, asyncParams);
        }
    }
    return real_FSGetFreeSpaceSizeAsync(pClient, pCmd, path, returnedFreeSize, error, asyncParams);
}