Esempio n. 1
0
/*!
 * Saves the object to an XML file. Safe.
 *
 * \throws	ExceptionIO	cannot write file
 * \throws	ExceptionProtocol	save unimplemented
 *
 * \param[in]	fname	the file name
 */
void Savable::Save(const Path &fname)
{
	std::lock_guard<std::mutex> lock(*filelock);
	Path fn;
	if (fname.IsAbsolute())
		fn = fname;
	else
		fn = completeFilename(fname);
	save(fn);
	filename = fname;
}
Esempio n. 2
0
File: Path.hpp Progetto: hweom/ccb
        inline friend Path operator / (const Path& path1, const Path& path2)
        {
            if (path2.IsAbsolute())
            {
                throw std::logic_error("Cannot concatenate an absolute path");
            }

            Path result(path1);
            for (auto& step : path2.path)
            {
                result.path.push_back(step);
            }

            return result;
        }
Esempio n. 3
0
gcc_const
static AllocatedPath
FindFile(const char *const*list)
{
  for (const char *const* i = list; *i != nullptr; ++i) {
    const Path path(*i);

    if (path.IsAbsolute()) {
      if (File::Exists(path))
        return path;
    } else {
      auto result = FindInSearchPaths(path);
      if (result != nullptr)
        return result;
    }
  }

  return nullptr;
}