Fix configuration file I/O (#8)
Due to a programming error introduced in commit 83ec72e80c
, an instance
of std::ifstream was being initialized with the path to the website
directory (without the file name appended to the path).
This commit is contained in:
parent
2cc0fa67c5
commit
fb546ccec8
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2023 luca0N!
|
||||
* Copyright (C) 2022-2024 luca0N!
|
||||
*
|
||||
* This file is part of Static Website Generator (swg).
|
||||
*
|
||||
|
@ -39,6 +39,8 @@
|
|||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
const std::string SWG_CONFIG_FILENAME = "swg.cfg";
|
||||
|
||||
struct Blog {
|
||||
char name[64],
|
||||
path[64],
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2023 luca0N!
|
||||
* Copyright (C) 2022-2024 luca0N!
|
||||
*
|
||||
* This file is part of Static Website Generator (swg).
|
||||
*
|
||||
|
@ -34,8 +34,10 @@ void parse_config(SwgContext *ctx, std::string const &path) {
|
|||
|
||||
int blogCount = 0;
|
||||
Blog *currentBlog = NULL;
|
||||
std::ifstream cfgStream(path + "/" + SWG_CONFIG_FILENAME);
|
||||
if (!cfgStream)
|
||||
throw std::runtime_error("Couldn't find swg configuration file at the specified path: " + path);
|
||||
|
||||
std::ifstream cfgStream(path);
|
||||
// Parse configuration file
|
||||
for (std::string line; std::getline(cfgStream, line);) {
|
||||
// Skip comment lines
|
||||
|
|
Loading…
Reference in New Issue