Remove PATH_SEP, set PATH_SEP_CHAR in meson.build
This commit is contained in:
parent
36d6f1d67e
commit
8680f0d4a7
@ -361,6 +361,7 @@ conf_data.set('APPVENDOR', get_option('app_vendor'))
|
||||
conf_data.set('LUACONSOLE', lua_variant != 'none' ? 'true' : 'false')
|
||||
conf_data.set('GRAVFFT', enable_gravfft ? 'true' : 'false')
|
||||
conf_data.set('NOHTTP', not enable_http ? 'true' : 'false')
|
||||
conf_data.set('PATH_SEP_CHAR', host_platform == 'windows' ? '\\\\' : '/')
|
||||
|
||||
data_files = []
|
||||
|
||||
|
@ -15,6 +15,7 @@ constexpr bool USE_UPDATESERVER = @USE_UPDATESERVER@;
|
||||
constexpr bool INSTALL_CHECK = @INSTALL_CHECK@;
|
||||
constexpr bool IGNORE_UPDATES = @IGNORE_UPDATES@;
|
||||
constexpr bool ENFORCE_HTTPS = @ENFORCE_HTTPS@;
|
||||
constexpr char PATH_SEP_CHAR = '@PATH_SEP_CHAR@';
|
||||
|
||||
constexpr char SERVER[] = "@SERVER@";
|
||||
constexpr char STATICSERVER[] = "@STATICSERVER@";
|
||||
@ -28,14 +29,6 @@ constexpr char APPID[] = "@APPID@";
|
||||
constexpr char APPDATA[] = "@APPDATA@";
|
||||
constexpr char APPVENDOR[] = "@APPVENDOR@";
|
||||
|
||||
#ifdef WIN
|
||||
constexpr char PATH_SEP[] = "\\";
|
||||
constexpr char PATH_SEP_CHAR = '\\';
|
||||
#else
|
||||
constexpr char PATH_SEP[] = "/";
|
||||
constexpr char PATH_SEP_CHAR = '/';
|
||||
#endif
|
||||
|
||||
constexpr int SAVE_VERSION = 97;
|
||||
constexpr int MINOR_VERSION = 0;
|
||||
constexpr int BUILD_NUM = 352;
|
||||
|
@ -67,7 +67,7 @@ void Client::Initialize()
|
||||
|
||||
//Read stamps library
|
||||
std::ifstream stampsLib;
|
||||
stampsLib.open(ByteString::Build(STAMPS_DIR, PATH_SEP, "stamps.def"), std::ios::binary);
|
||||
stampsLib.open(ByteString::Build(STAMPS_DIR, PATH_SEP_CHAR, "stamps.def"), std::ios::binary);
|
||||
while (!stampsLib.eof())
|
||||
{
|
||||
char data[11];
|
||||
@ -482,7 +482,7 @@ void Client::MoveStampToFront(ByteString stampID)
|
||||
|
||||
SaveFile * Client::GetStamp(ByteString stampID)
|
||||
{
|
||||
ByteString stampFile = ByteString(ByteString::Build(STAMPS_DIR, PATH_SEP, stampID, ".stm"));
|
||||
ByteString stampFile = ByteString(ByteString::Build(STAMPS_DIR, PATH_SEP_CHAR, stampID, ".stm"));
|
||||
SaveFile *saveFile = LoadSaveFile(stampFile);
|
||||
if (!saveFile)
|
||||
saveFile = LoadSaveFile(stampID);
|
||||
@ -497,7 +497,7 @@ void Client::DeleteStamp(ByteString stampID)
|
||||
{
|
||||
if ((*iterator) == stampID)
|
||||
{
|
||||
ByteString stampFilename = ByteString::Build(STAMPS_DIR, PATH_SEP, stampID, ".stm");
|
||||
ByteString stampFilename = ByteString::Build(STAMPS_DIR, PATH_SEP_CHAR, stampID, ".stm");
|
||||
remove(stampFilename.c_str());
|
||||
stampIDs.erase(iterator);
|
||||
break;
|
||||
@ -518,7 +518,7 @@ ByteString Client::AddStamp(GameSave * saveData)
|
||||
else
|
||||
lastStampName++;
|
||||
ByteString saveID = ByteString::Build(Format::Hex(Format::Width(lastStampTime, 8)), Format::Hex(Format::Width(lastStampName, 2)));
|
||||
ByteString filename = ByteString::Build(STAMPS_DIR, PATH_SEP, saveID, ".stm");
|
||||
ByteString filename = ByteString::Build(STAMPS_DIR, PATH_SEP_CHAR, saveID, ".stm");
|
||||
|
||||
Platform::MakeDirectory(STAMPS_DIR);
|
||||
|
||||
@ -553,7 +553,7 @@ void Client::updateStamps()
|
||||
Platform::MakeDirectory(STAMPS_DIR);
|
||||
|
||||
std::ofstream stampsStream;
|
||||
stampsStream.open(ByteString::Build(STAMPS_DIR, PATH_SEP, "stamps.def").c_str(), std::ios::binary);
|
||||
stampsStream.open(ByteString::Build(STAMPS_DIR, PATH_SEP_CHAR, "stamps.def").c_str(), std::ios::binary);
|
||||
for (std::list<ByteString>::const_iterator iterator = stampIDs.begin(), end = stampIDs.end(); iterator != end; ++iterator)
|
||||
{
|
||||
stampsStream.write((*iterator).c_str(), 10);
|
||||
|
@ -20,7 +20,7 @@ std::vector<ByteString> DirectorySearch(ByteString directory, ByteString search,
|
||||
//Get full file listing
|
||||
//Normalise directory string, ensure / or \ is present
|
||||
if (!directory.size() || (directory.back() != '/' && directory.back() != '\\'))
|
||||
directory += PATH_SEP;
|
||||
directory.append(1, PATH_SEP_CHAR);
|
||||
auto directoryList = DirectoryList(directory);
|
||||
|
||||
search = search.ToLower();
|
||||
|
@ -46,7 +46,7 @@ class LoadFilesTask: public Task
|
||||
SaveFile * saveFile = new SaveFile(directory + *iter, true);
|
||||
saveFiles.push_back(saveFile);
|
||||
|
||||
ByteString filename = (*iter).SplitFromEndBy(PATH_SEP).After();
|
||||
ByteString filename = (*iter).SplitFromEndBy(PATH_SEP_CHAR).After();
|
||||
filename = filename.SplitFromEndBy('.').Before();
|
||||
saveFile->SetDisplayName(filename.FromUtf8());
|
||||
}
|
||||
@ -149,7 +149,7 @@ void FileBrowserActivity::RenameSave(SaveFile * file)
|
||||
ByteString newName = TextPrompt::Blocking("Rename", "Change save name", file->GetDisplayName(), "", 0).ToUtf8();
|
||||
if (newName.length())
|
||||
{
|
||||
newName = directory + PATH_SEP + newName + ".cps";
|
||||
newName = ByteString::Build(directory, PATH_SEP_CHAR, newName, ".cps");
|
||||
int ret = rename(file->GetName().c_str(), newName.c_str());
|
||||
if (ret)
|
||||
ErrorMessage::Blocking("Error", "Could not rename file");
|
||||
|
@ -1263,7 +1263,7 @@ void GameController::OpenSavePreview()
|
||||
|
||||
void GameController::OpenLocalBrowse()
|
||||
{
|
||||
new FileBrowserActivity(ByteString(LOCAL_SAVE_DIR) + PATH_SEP, [this](std::unique_ptr<SaveFile> file) {
|
||||
new FileBrowserActivity(ByteString::Build(LOCAL_SAVE_DIR, PATH_SEP_CHAR), [this](std::unique_ptr<SaveFile> file) {
|
||||
HistorySnapshot();
|
||||
LoadSaveFile(file.get());
|
||||
});
|
||||
|
@ -478,7 +478,7 @@ void GameModel::BuildBrushList()
|
||||
for (size_t i = 0; i < brushFiles.size(); i++)
|
||||
{
|
||||
std::vector<char> brushData;
|
||||
if (!Platform::ReadFile(brushData, BRUSH_DIR + ByteString(PATH_SEP) + brushFiles[i]))
|
||||
if (!Platform::ReadFile(brushData, ByteString::Build(BRUSH_DIR, PATH_SEP_CHAR, brushFiles[i])))
|
||||
{
|
||||
std::cout << "Brushes: Skipping " << brushFiles[i] << ". Could not open" << std::endl;
|
||||
continue;
|
||||
|
@ -1004,7 +1004,7 @@ int GameView::Record(bool record)
|
||||
time_t startTime = time(NULL);
|
||||
recordingFolder = startTime;
|
||||
Platform::MakeDirectory("recordings");
|
||||
Platform::MakeDirectory(ByteString::Build("recordings", PATH_SEP, recordingFolder).c_str());
|
||||
Platform::MakeDirectory(ByteString::Build("recordings", PATH_SEP_CHAR, recordingFolder).c_str());
|
||||
recording = true;
|
||||
recordingIndex = 0;
|
||||
}
|
||||
@ -2207,7 +2207,7 @@ void GameView::OnDraw()
|
||||
VideoBuffer screenshot(ren->DumpFrame());
|
||||
std::vector<char> data = format::VideoBufferToPPM(screenshot);
|
||||
|
||||
ByteString filename = ByteString::Build("recordings", PATH_SEP, recordingFolder, PATH_SEP, "frame_", Format::Width(recordingIndex++, 6), ".ppm");
|
||||
ByteString filename = ByteString::Build("recordings", PATH_SEP_CHAR, recordingFolder, PATH_SEP_CHAR, "frame_", Format::Width(recordingIndex++, 6), ".ppm");
|
||||
|
||||
Platform::WriteFile(data, filename);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ void LocalSaveActivity::Save()
|
||||
}
|
||||
else if (filenameField->GetText().length())
|
||||
{
|
||||
ByteString finalFilename = ByteString(LOCAL_SAVE_DIR) + ByteString(PATH_SEP) + filenameField->GetText().ToUtf8() + ".cps";
|
||||
ByteString finalFilename = ByteString::Build(LOCAL_SAVE_DIR, PATH_SEP_CHAR, filenameField->GetText().ToUtf8(), ".cps");
|
||||
save.SetDisplayName(filenameField->GetText());
|
||||
save.SetFileName(finalFilename);
|
||||
if (Platform::FileExists(finalFilename))
|
||||
|
Loading…
Reference in New Issue
Block a user