mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2024-11-24 04:15:39 +01:00
The basename default should be the filename itself
This commit is contained in:
parent
03b9e7f413
commit
d13cca3362
@ -91,7 +91,7 @@ void ExtractBasename(const char *filename, char *buf, size_t bufSz) {
|
|||||||
size_t len = strlen(filename);
|
size_t len = strlen(filename);
|
||||||
const char *end = filename + len;
|
const char *end = filename + len;
|
||||||
const char *ext = end;
|
const char *ext = end;
|
||||||
const char *base = NULL;
|
const char *base = filename;
|
||||||
while(--end != filename && !base) {
|
while(--end != filename && !base) {
|
||||||
if(*end == '.') {
|
if(*end == '.') {
|
||||||
ext = end;
|
ext = end;
|
||||||
@ -100,11 +100,6 @@ void ExtractBasename(const char *filename, char *buf, size_t bufSz) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!base) {
|
|
||||||
fprintf(stderr, "Filename (%s) has no extension, we don't know how to deal with it!\n", filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t numChars = ext - base + 1;
|
size_t numChars = ext - base + 1;
|
||||||
size_t toCopy = ::std::min(numChars, bufSz);
|
size_t toCopy = ::std::min(numChars, bufSz);
|
||||||
memcpy(buf, base, toCopy);
|
memcpy(buf, base, toCopy);
|
||||||
|
Loading…
Reference in New Issue
Block a user