fix: build on linux
This commit is contained in:
parent
392e11ce5c
commit
7e5df09232
|
@ -9,8 +9,6 @@ set(CMAKE_AUTORCC ON)
|
||||||
set(CMAKE_AUTOUIC ON)
|
set(CMAKE_AUTOUIC ON)
|
||||||
set(QRC_SOURCE_FILES Resources.qrc)
|
set(QRC_SOURCE_FILES Resources.qrc)
|
||||||
|
|
||||||
set(CMAKE_PREFIX_PATH "C:/Users/ricardo.DESKTOP-N6OVBK5/Programs/Qt/6.1.3/msvc2019_64")
|
|
||||||
|
|
||||||
find_package(Qt6 COMPONENTS
|
find_package(Qt6 COMPONENTS
|
||||||
Core
|
Core
|
||||||
Gui
|
Gui
|
||||||
|
|
|
@ -6,20 +6,17 @@
|
||||||
|
|
||||||
BusStrategyBase *StrategyFactory::GetStrategy(const QString& file_name)
|
BusStrategyBase *StrategyFactory::GetStrategy(const QString& file_name)
|
||||||
{
|
{
|
||||||
QByteArray bytes = file_name.toLatin1();
|
|
||||||
|
|
||||||
FILE *config_file = nullptr;
|
|
||||||
char buffer[30];
|
char buffer[30];
|
||||||
int total_station = 0;
|
int total_station = 0;
|
||||||
int distance = 0;
|
int distance = 0;
|
||||||
int chosen_strategy = 0;
|
int chosen_strategy = 0;
|
||||||
|
|
||||||
fopen_s(&config_file, bytes.data(), "r");
|
FILE *file = fopen(file_name.toLatin1().data(), "r");
|
||||||
|
|
||||||
// 循环读取文件的每一行
|
// 循环读取文件的每一行
|
||||||
while (fgets(buffer, sizeof buffer, config_file) != nullptr)
|
while (fgets(buffer, 30, file) != nullptr)
|
||||||
{
|
{
|
||||||
char first_char = buffer[0];
|
const char first_char = buffer[0];
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
switch (first_char)
|
switch (first_char)
|
||||||
|
@ -101,10 +98,12 @@ BusStrategyBase *StrategyFactory::GetStrategy(const QString& file_name)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(file);
|
||||||
|
|
||||||
// 处理参数去缺省值的情况
|
// 处理参数去缺省值的情况
|
||||||
if (distance == 0)
|
if (distance == 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user