Skip to content

Commit

Permalink
Address reviewer feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Addisu Z. Taddese <[email protected]>
  • Loading branch information
azeey committed Aug 23, 2024
1 parent 4330ef9 commit c2fa792
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/gz/gui/Application.hh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ namespace gz::gui
/// \sa InitializeDialogs
public: bool LoadConfig(const std::string &_path);

/// \brief Load window configuration from XML element.
/// This is the <window> element inside a gui config file.
/// \param[in] _window XML element that contains the window configuration
/// \return True if successful
public: bool LoadWindowConfig(const tinyxml2::XMLElement &_window);

/// \brief Load the configuration from the default config file.
Expand All @@ -122,6 +126,11 @@ namespace gz::gui
/// \sa SetDefaultConfigPath
public: std::string DefaultConfigPath();

/// \brief Given an input config path, resolve its absolute path,
/// potentially searching for it in locations specified by
/// `GZ_GUI_RESOURCE_PATH`.
/// \input _path Path to a config file. If the path is absolute
/// \return The resolved path
public: std::string ResolveConfigFile(const std::string &_path);

/// \brief Set the environment variable which defines the paths to
Expand Down
6 changes: 6 additions & 0 deletions src/Application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ std::string Application::DefaultConfigPath()
return this->dataPtr->defaultConfigPath;
}

/////////////////////////////////////////////////
std::string Application::ResolveConfigFile(const std::string &_path)
{
std::string configFull = _path;
Expand Down Expand Up @@ -534,6 +535,11 @@ std::string Application::ResolveConfigFile(const std::string &_path)
}
}

if (common::isRelativePath(configFull))
{
configFull = common::absPath(configFull);
}

return configFull;
}

Expand Down

0 comments on commit c2fa792

Please sign in to comment.