}
-void
-fgLoadProps (const char * path, SGPropertyNode * props)
-{
- SGPath loadpath(globals->get_fg_root());
- loadpath.append(path);
- readProperties(loadpath.c_str(), props);
+bool
+fgLoadProps (const char * path, SGPropertyNode * props, bool in_fg_root)
+{
+ string fullpath;
+ if (in_fg_root) {
+ SGPath loadpath(globals->get_fg_root());
+ loadpath.append(path);
+ fullpath = loadpath.str();
+ } else {
+ fullpath = path;
+ }
+
+ try {
+ readProperties(fullpath, props);
+ } catch (const sg_exception &e) {
+ guiErrorMessage("Error reading properties: ", e);
+ return false;
+ }
+ return true;
}
/**
- * Load properties from a file relative to $FG_ROOT.
- *
- * @param file The file name relative to $FG_ROOT.
- */
-extern void fgLoadProps (const char * path, SGPropertyNode * props);
+ * Load properties from a file.
+ *
+ * @param file The relative or absolute filename.
+ * @param props The property node to load the properties into.
+ * @param in_fg_root If true, look for the file relative to
+ * $FG_ROOT; otherwise, look for the file relative to the
+ * current working directory.
+ * @return true if the properties loaded successfully, false
+ * otherwise.
+ */
+extern bool fgLoadProps (const char * path, SGPropertyNode * props,
+ bool in_fg_root = true);
\f