Cleanup.
This commit is contained in:
parent
2df32373f9
commit
24e796fa5b
@ -5,7 +5,7 @@
|
||||
|
||||
#include <bx/bx.h>
|
||||
#include <bgfx/bgfx.h>
|
||||
#include <bx/string.h>
|
||||
#include <bx/filepath.h>
|
||||
#include <bx/crtimpl.h>
|
||||
#include <bx/sort.h>
|
||||
|
||||
@ -585,7 +585,12 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
inputAddBindings("bindings", s_bindings);
|
||||
|
||||
entry::WindowHandle defaultWindow = { 0 };
|
||||
entry::setWindowTitle(defaultWindow, bx::baseName(_argv[0]) );
|
||||
|
||||
bx::FilePath fp(_argv[0]);
|
||||
char title[bx::kMaxFilePath];
|
||||
bx::strCopy(title, BX_COUNTOF(title), fp.getBaseName() );
|
||||
|
||||
entry::setWindowTitle(defaultWindow, title);
|
||||
setWindowSize(defaultWindow, ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT);
|
||||
|
||||
sortApps();
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "shaderc.h"
|
||||
#include <bx/commandline.h>
|
||||
#include <bx/filepath.h>
|
||||
|
||||
#define MAX_TAGS 256
|
||||
extern "C"
|
||||
@ -704,6 +705,18 @@ namespace bgfx
|
||||
strReplace(_data, find, "bgfx_VoidFrag");
|
||||
}
|
||||
|
||||
const char* baseName(const char* _filePath)
|
||||
{
|
||||
bx::FilePath fp(_filePath);
|
||||
char tmp[bx::kMaxFilePath];
|
||||
bx::strCopy(tmp, BX_COUNTOF(tmp), fp.getFileName() );
|
||||
const char* base = bx::strFind(_filePath, tmp);
|
||||
printf(" tmp: %s\n", tmp);
|
||||
printf(" fp: %s\n", _filePath);
|
||||
printf("base: %s\n", base);
|
||||
return base;
|
||||
}
|
||||
|
||||
// c - compute
|
||||
// d - domain
|
||||
// f - fragment
|
||||
@ -888,7 +901,7 @@ namespace bgfx
|
||||
bin2c = cmdLine.findOption("bin2c");
|
||||
if (NULL == bin2c)
|
||||
{
|
||||
bin2c = bx::baseName(outFilePath);
|
||||
bin2c = baseName(outFilePath);
|
||||
uint32_t len = (uint32_t)bx::strLen(bin2c);
|
||||
char* temp = (char*)alloca(len+1);
|
||||
for (char *out = temp; *bin2c != '\0';)
|
||||
@ -927,7 +940,7 @@ namespace bgfx
|
||||
|
||||
std::string dir;
|
||||
{
|
||||
const char* base = bx::baseName(filePath);
|
||||
const char* base = baseName(filePath);
|
||||
|
||||
if (base != filePath)
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <bgfx/bgfx.h>
|
||||
#include <bx/commandline.h>
|
||||
#include <bx/os.h>
|
||||
#include <bx/string.h>
|
||||
#include <bx/filepath.h>
|
||||
#include <bx/uint32_t.h>
|
||||
#include <bx/fpumath.h>
|
||||
#include <bx/easing.h>
|
||||
@ -490,7 +490,7 @@ struct View
|
||||
return 0;
|
||||
}
|
||||
|
||||
void updateFileList(const char* _path, const char* _fileName = "")
|
||||
void updateFileList(const char* _path, const bx::StringView& _fileName)
|
||||
{
|
||||
std::string path = _path;
|
||||
|
||||
@ -524,7 +524,7 @@ struct View
|
||||
|
||||
if (supported)
|
||||
{
|
||||
if (0 == bx::strCmp(_fileName, item->d_name) )
|
||||
if (0 == bx::strCmp(item->d_name, _fileName) )
|
||||
{
|
||||
m_fileIndex = uint32_t(m_fileList.size() );
|
||||
}
|
||||
@ -1072,13 +1072,13 @@ int _main_(int _argc, char** _argv)
|
||||
std::string path = filePath;
|
||||
if (!directory)
|
||||
{
|
||||
const char* fileName = directory ? filePath : bx::baseName(filePath);
|
||||
path.assign(filePath, fileName);
|
||||
view.updateFileList(path.c_str(), fileName);
|
||||
bx::FilePath fp(filePath);
|
||||
path.assign(fp.getPath().getPtr(), fp.getPath().getTerm() );
|
||||
view.updateFileList(path.c_str(), fp.getFileName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
view.updateFileList(path.c_str() );
|
||||
view.updateFileList(path.c_str(), "");
|
||||
}
|
||||
|
||||
int exitcode = bx::kExitSuccess;
|
||||
|
Loading…
Reference in New Issue
Block a user