Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions source/Config/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
** Author Francois Michaut
**
** Started on Tue Sep 13 11:29:35 2022 Francois Michaut
** Last update Fri Aug 22 20:39:00 2025 Francois Michaut
** Last update Sun Aug 24 19:46:07 2025 Francois Michaut
**
** FileShareConfig.cpp : FileShareConfig implementation
*/
Expand All @@ -22,12 +22,11 @@
const char * const DEFAULT_PATH = "~/.fsp/default_config";

namespace FileShare {
Config::Config() {
if (m_downloads_folder.empty()) {
// TODO: replace by cross-plateform way of getting the dowloads folder
m_downloads_folder = FileShare::Utils::resolve_home_component("~/Downloads/FileShare");
}
}
Config::Config() :
m_filepath(FileShare::Utils::resolve_home_component(DEFAULT_PATH)),
// TODO: replace by cross-plateform way of getting the dowloads folder
m_downloads_folder(FileShare::Utils::resolve_home_component("~/Downloads/FileShare"))
{}

Config::Config(bool /*_*/) {}

Expand Down
5 changes: 4 additions & 1 deletion source/Config/ServerConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
** Author Francois Michaut
**
** Started on Wed Aug 6 15:19:24 2025 Francois Michaut
** Last update Fri Aug 22 20:42:47 2025 Francois Michaut
** Last update Sun Aug 24 19:48:12 2025 Francois Michaut
**
** ServerConfig.cpp : Server Configuration Implementation
*/
Expand All @@ -24,6 +24,7 @@ const char * const DEFAULT_PATH = "~/.fsp/server_config";

namespace FileShare {
ServerConfig::ServerConfig() :
m_filepath(FileShare::Utils::resolve_home_component(DEFAULT_PATH)),
m_uuid("0000-0000-0000-0000") // TODO: Generate Random UUID
{}

Expand Down Expand Up @@ -59,6 +60,8 @@ namespace FileShare {
std::ifstream file(config.m_filepath, std::ios_base::binary | std::ios_base::in);
cereal::BinaryInputArchive archive(file);

// TODO: Will crash if file doesn't exist. Do we want to create it ?
// It could also be an error if the config is missing -> TBD
archive(config);
// TODO: Need to validate config - if someone messes up the file, we could have problems
// (Or if private_keys_dir contains ~, it needs to be expanded)
Expand Down
Loading