Fail if config can't be read.
the build was successful
Details
the build was successful
Details
This commit is contained in:
parent
c0793664f9
commit
cc974b5cbb
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required (VERSION 3.2)
|
||||
project(compilescript
|
||||
VERSION 0.3.0
|
||||
VERSION 0.3.1
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
|
|
11
src/main.cpp
11
src/main.cpp
|
@ -46,13 +46,13 @@ string compiler = "g++";
|
|||
fs::path cache_dir;
|
||||
int clean_after_hours = 30 * 24;
|
||||
|
||||
void read_settings()
|
||||
bool read_settings()
|
||||
{
|
||||
bool need_save = false;
|
||||
xdgcfg config("compilescript.cfg");
|
||||
if (config.read() != 0)
|
||||
{
|
||||
config.write();
|
||||
return false;
|
||||
}
|
||||
libconfig::Setting &cfg = config.get_cfg().getRoot();
|
||||
|
||||
|
@ -98,6 +98,8 @@ void read_settings()
|
|||
{
|
||||
config.write();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void cleanup()
|
||||
|
@ -128,7 +130,10 @@ void cleanup()
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
read_settings();
|
||||
if (!read_settings())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (argc <= 1)
|
||||
{
|
||||
|
|
Reference in New Issue