Commit f110d822 authored by nanahira's avatar nanahira

Merge branch 'master' of github.com:Fluorohydride/ygopro into server_mc

parents 98b56b0c 4cf6f2f4
Pipeline #5537 passed with stages
in 2 minutes and 16 seconds
...@@ -309,6 +309,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -309,6 +309,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int extra = replay.ReadInt32(); int extra = replay.ReadInt32();
for(int j = 0; j < extra; ++j) for(int j = 0; j < extra; ++j)
tmp_deck.extra.push_back(dataManager.GetCodePointer(replay.ReadInt32())); tmp_deck.extra.push_back(dataManager.GetCodePointer(replay.ReadInt32()));
FileSystem::SafeFileName(namebuf[i]);
myswprintf(filename, L"deck/%ls-%d %ls.ydk", ex_filename, i + 1, namebuf[i]); myswprintf(filename, L"deck/%ls-%d %ls.ydk", ex_filename, i + 1, namebuf[i]);
deckManager.SaveDeck(tmp_deck, filename); deckManager.SaveDeck(tmp_deck, filename);
} }
......
...@@ -19,6 +19,11 @@ ...@@ -19,6 +19,11 @@
class FileSystem { class FileSystem {
public: public:
static void SafeFileName(wchar_t* wfile) {
while((wfile = wcspbrk(wfile, L"<>:\"/\\|?*")) != NULL)
*wfile++ = '_';
}
static bool IsFileExists(const wchar_t* wfile) { static bool IsFileExists(const wchar_t* wfile) {
DWORD attr = GetFileAttributesW(wfile); DWORD attr = GetFileAttributesW(wfile);
return attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY); return attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY);
...@@ -112,6 +117,11 @@ public: ...@@ -112,6 +117,11 @@ public:
class FileSystem { class FileSystem {
public: public:
static void SafeFileName(wchar_t* wfile) {
while((wfile = wcspbrk(wfile, L"/")) != NULL)
*wfile++ = '_';
}
static bool IsFileExists(const char* file) { static bool IsFileExists(const char* file) {
struct stat fileStat; struct stat fileStat;
return (stat(file, &fileStat) == 0) && !S_ISDIR(fileStat.st_mode); return (stat(file, &fileStat) == 0) && !S_ISDIR(fileStat.st_mode);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -8,8 +8,8 @@ nickname = Player ...@@ -8,8 +8,8 @@ nickname = Player
gamename = Game gamename = Game
lastcategory = 未分类卡组 lastcategory = 未分类卡组
lastdeck = new lastdeck = new
textfont = c:/windows/fonts/simsun.ttc 14 textfont = ./fonts/textFont.ttf 14
numfont = c:/windows/fonts/arialbd.ttf numfont = ./fonts/numFont.ttf
serverport = 7911 serverport = 7911
lasthost = 127.0.0.1 lasthost = 127.0.0.1
lastport = 7911 lastport = 7911
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment