• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。


Commit MetaInfo

Revision329 (tree)
Time2022-09-18 17:05:20
Authorxops-mikan

Log Message

起動時にdataフォルダの有無をチェックするように、デバック用ログの出力項目を追加

Change Summary

Incremental Difference

--- trunk/datafile.cpp (revision 328)
+++ trunk/datafile.cpp (revision 329)
@@ -1732,4 +1732,14 @@
17321732 }
17331733 }
17341734 return false;
1735-}
\ No newline at end of file
1735+}
1736+
1737+//! @brief ディレクトリの存在を判定
1738+//! @param dir ディレクトリ名
1739+//! @return 存在する:true 存在しない:false
1740+bool CheckDirectory(const char *dir)
1741+{
1742+ struct stat statBuf;
1743+ if( stat(dir, &statBuf) == 0 ){ return true; }
1744+ return false;
1745+}
--- trunk/datafile.h (revision 328)
+++ trunk/datafile.h (revision 329)
@@ -55,6 +55,7 @@
5555 #include "main.h"
5656
5757 #include <ctype.h>
58+#include <sys/stat.h>
5859
5960 //! ブロックデータ用構造体 (blockdata構造体で使用)
6061 typedef struct
@@ -246,5 +247,6 @@
246247 bool CheckFullPath(const char *path);
247248 void GetFileDirectory(const char *path, char *dir);
248249 bool CheckFileExtension(const char *filepath, const char *checkstr);
250+bool CheckDirectory(const char *dir);
249251
250252 #endif
\ No newline at end of file
--- trunk/main.cpp (revision 328)
+++ trunk/main.cpp (revision 329)
@@ -160,6 +160,33 @@
160160 OutputLog.WriteLog(LOG_CHECK, "Startup", "Visual C++ debug mode");
161161 #endif
162162
163+#ifdef _DEBUG
164+ char path2[MAX_PATH];
165+ getcwd(path2, MAX_PATH);
166+ sprintf(infostr, "EXE directory path length : %d", strlen(path2));
167+
168+ //ログに出力
169+ OutputLog.WriteLog(LOG_CHECK, "Environment", infostr);
170+#endif
171+
172+ //データフォルダチェック
173+#ifdef ENABLE_DEBUGLOG
174+ //ログに出力
175+ OutputLog.WriteLog(LOG_LOAD, "Directory", "data folder");
176+ if( CheckDirectory("data") == true ){
177+ OutputLog.WriteLog(LOG_COMPLETE, "", "");
178+ }
179+ else{
180+ OutputLog.WriteLog(LOG_ERROR, "", "");
181+ }
182+#endif
183+#ifdef ENABLE_CHECKDATADIR
184+ if( CheckDirectory("data") == false ){
185+ MainWindow.ErrorInfo("Data directory not exist.\n\nPlease download and copy \"X operations 0.96\".");
186+ return 1;
187+ }
188+#endif
189+
163190 //設定ファイル読み込み
164191 if( GameConfig.LoadFile("config.dat") == 1 ){
165192 #ifndef ENABLE_AUTOCREATECONFIG
--- trunk/main.h (revision 328)
+++ trunk/main.h (revision 329)
@@ -79,6 +79,7 @@
7979 //#define ENABLE_PATH_DELIMITER_SLASH //!< パス区切り文字を、'\'から‘/’へ変換する。
8080 #define ENABLE_AUTOLOADMIF //!< .mifが引数に指定された場合、自動的にロードする(コメント化で機能無効)
8181 #define ENABLE_ADDCONFIG //!< iniファイルによる追加設定を取得する(コメント化で機能無効)
82+#define ENABLE_CHECKDATADIR //!< 起動時にdataフォルダーの有無をチェックする(コメント化で機能無効)
8283
8384 //windows.hを使用しないならば
8485 #ifndef _MAX_PATH