-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exception handling for wrong file and directory paths #2
Comments
Hi, |
Hey here is a snippet of my ReadIndex
And here is the replace_str function char *replace_str(const char *str, const char *old, const char *new)
{
char *ret, *r;
const char *p, *q;
size_t oldlen = strlen(old);
size_t count, retlen, newlen = strlen(new);
int samesize = (oldlen == newlen);
if (!samesize) {
for (count = 0, p = str; (q = strstr(p, old)) != NULL; p = q + oldlen)
count++;
retlen = p - str + strlen(p) + count * (newlen - oldlen);
} else
retlen = strlen(str);
if ((ret = malloc(retlen + 1)) == NULL)
return NULL;
r = ret, p = str;
while (1) {
if (!samesize && !count--)
break;
if ((q = strstr(p, old)) == NULL)
break;
ptrdiff_t l = q - p;
memcpy(r, p, l);
r += l;
memcpy(r, new, newlen);
r += newlen;
p = q + oldlen;
}
strcpy(r, p);
return ret;
} |
Humm.. looks like that's from a backup made on the ps3 itself, not from a backup made with ps3xport.. so, does this mean that the directory name contains that "" inside the original backup? I've never seen this and it makes no sense unless the directory name contains the actual "" character, not as a directory separator. In such a case, I don't know if it would work if you dump/recreate the backup, as the directory name would change.. It could work on linux if we keep it that way but on windows, that would be impossible since "" is a reserved character and can't appear in the filename. |
Humm.. something for you to look for, can you check the ReadIndex directories, it should print the files then the directories. |
By the way, if you wanted a search/replace for a single char, it would be faster/easier to optimize that function into something like this (could add a strdup() at the start if you don't want to modify the string) :
|
I have no clue what any of this is, I'm just trying to write a batch script
|
I'm sure that the slashes are facing the right way (I saw the other guy's
|
in my backup are serveral files which have a "" seperator instead of "/", this produce an error for creating directories and files. (Don't know why this inside my backup)
I have added a "replace_str" function which can replace any "" with "/".
You can call this function in archive.c [function: archive_dump]
"snprintf (buffer, sizeof(buffer), "%s/%s", output, replace_str(dir->path, "" , "/"));"
and
"snprintf (buffer, sizeof(buffer), "%s/%s", output, replace_str(file->path, "" , "/"));"
Is it possible to add this functionality to the "correct" positions in the code.
Thanks
The text was updated successfully, but these errors were encountered: