refactor: getAppFileName() 移动到 main.c

This commit is contained in:
Calcitem 2020-08-30 21:22:07 +08:00
parent d5403c95a8
commit 9319dd3ac1
3 changed files with 13 additions and 18 deletions

View File

@ -488,16 +488,3 @@ void bindThisThread(size_t idx)
#endif
} // namespace WinProcGroup
///////////////////////////////////////////////////////////////////////////////
#include <QCoreApplication>
QString getAppFileName()
{
QString filename;
filename = QCoreApplication::applicationFilePath().mid(QCoreApplication::applicationDirPath().size() + 1);
filename = filename.mid(0, filename.size() - QString(".exe").size());
return filename;
}

View File

@ -163,8 +163,6 @@ inline uint64_t rand56()
return rand64() << 8;
}
extern QString getAppFileName();
void start_logger(const std::string &fname);
#endif // #ifndef MISC_H_INCLUDED

View File

@ -17,9 +17,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QtWidgets/QApplication>
#include <QDesktopWidget>
#include "gamewindow.h"
#include "misc.h"
#include "bitboard.h"
@ -27,9 +24,22 @@
QString APP_FILENAME_DEFAULT = "MillGame";
#ifdef QT_UI
#include <QtWidgets/QApplication>
#include <QDesktopWidget>
#include <QCoreApplication>
#ifndef TRAINING_MODE
#ifndef UCT_DEMO
QString getAppFileName()
{
QString filename;
filename = QCoreApplication::applicationFilePath().mid(QCoreApplication::applicationDirPath().size() + 1);
filename = filename.mid(0, filename.size() - QString(".exe").size());
return filename;
}
int main(int argc, char *argv[])
{
Bitboards::init();