mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-07-07 14:10:40 +00:00
Change basename in cl tools to avoid directory information.
This commit is contained in:
parent
dbc7798655
commit
795e8dd32d
|
@ -69,16 +69,21 @@ void PrintUsage() {
|
||||||
void ExtractBasename(const char *filename, char *buf, int bufSz) {
|
void ExtractBasename(const char *filename, char *buf, int bufSz) {
|
||||||
int len = strlen(filename);
|
int len = strlen(filename);
|
||||||
const char *end = filename + len;
|
const char *end = filename + len;
|
||||||
while(--end != filename) {
|
const char *ext = end;
|
||||||
if(*end == '.')
|
const char *base = NULL;
|
||||||
{
|
while(--end != filename && !base) {
|
||||||
int numChars = end - filename + 1;
|
if(*end == '.') {
|
||||||
int toCopy = (numChars > bufSz)? bufSz : numChars;
|
ext = end;
|
||||||
memcpy(buf, filename, toCopy);
|
} else if(*end == '\\' || *end == '/') {
|
||||||
buf[toCopy - 1] = '\0';
|
base = end + 1;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int numChars = ext - base + 1;
|
||||||
|
int toCopy = ::std::min(numChars, bufSz);
|
||||||
|
memcpy(buf, base, toCopy);
|
||||||
|
buf[toCopy - 1] = '\0';
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
@ -69,19 +70,24 @@ void PrintUsage() {
|
||||||
fprintf(stderr, "\t-j <num>\tUse <num> blocks for each work item in a worker queue threading model. Default: (Blocks / Threads)\n");
|
fprintf(stderr, "\t-j <num>\tUse <num> blocks for each work item in a worker queue threading model. Default: (Blocks / Threads)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractBasename(const char *filename, char *buf, uint32 bufSz) {
|
void ExtractBasename(const char *filename, char *buf, int bufSz) {
|
||||||
size_t len = strlen(filename);
|
int len = strlen(filename);
|
||||||
const char *end = filename + len;
|
const char *end = filename + len;
|
||||||
while(--end != filename) {
|
const char *ext = end;
|
||||||
if(*end == '.')
|
const char *base = NULL;
|
||||||
{
|
while(--end != filename && !base) {
|
||||||
uint32 numChars = int32(end - filename + 1);
|
if(*end == '.') {
|
||||||
uint32 toCopy = (numChars > bufSz)? bufSz : numChars;
|
ext = end;
|
||||||
memcpy(buf, filename, toCopy);
|
} else if(*end == '\\' || *end == '/') {
|
||||||
buf[toCopy - 1] = '\0';
|
base = end + 1;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int numChars = ext - base + 1;
|
||||||
|
int toCopy = ::std::min(numChars, bufSz);
|
||||||
|
memcpy(buf, base, toCopy);
|
||||||
|
buf[toCopy - 1] = '\0';
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _tmain(int argc, _TCHAR* argv[])
|
int _tmain(int argc, _TCHAR* argv[])
|
||||||
|
|
Loading…
Reference in a new issue