Skip to content

Commit b83efc9

Browse files
committed
Rename to current_thread_path().
1 parent 25e8252 commit b83efc9

10 files changed

Lines changed: 24 additions & 24 deletions

File tree

src/client/build.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
#include <cppan_string.h>
2020
#include <filesystem.h>
2121

22-
int build(path fn = ::current_path(), const String &config = String());
22+
int build(path fn = current_thread_path(), const String &config = String());
2323
int build_only(path fn, const String &config = String());
2424
int build_package(const String &target_name, const path &settings_fn = path(), const String &config = String());

src/client/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void command_init(const Strings &args)
100100
String project_type = "e";
101101
String idir;
102102
Project p;
103-
p.name = ::current_path().filename().string();
103+
p.name = current_thread_path().filename().string();
104104

105105
// interactive mode
106106
if (args.empty())
@@ -216,7 +216,7 @@ void command_init(const Strings &args)
216216
}
217217

218218
boost::system::error_code ec;
219-
auto root = ::current_path();
219+
auto root = current_thread_path();
220220

221221
static const auto err_exist = "File or dir with such name already exist";
222222
static const auto int_main = "int main(int argc, char **argv)\n{\n return 0;\n}\n"s;

src/client/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ try
392392
Config c;
393393
c.load_current_config();
394394
Projects &projects = c.getProjects();
395-
const auto cwd = ::current_path();
395+
const auto cwd = current_thread_path();
396396
for (auto &ps : projects)
397397
{
398398
auto &project = ps.second;
@@ -402,7 +402,7 @@ try
402402
{
403403
p = t / fs::unique_path();
404404
fs::create_directories(p);
405-
::current_path(p);
405+
current_thread_path(p);
406406

407407
if (!isValidSourceUrl(project.source))
408408
throw std::runtime_error("Source is empty");
@@ -414,7 +414,7 @@ try
414414
{
415415
if (par)
416416
{
417-
::current_path(cwd);
417+
current_thread_path(cwd);
418418
remove_all_from_dir(p);
419419
}
420420
};
@@ -470,7 +470,7 @@ int main(int argc, char *argv[])
470470
void check_spec_file()
471471
{
472472
// no config - cannot do anything more
473-
if (!fs::exists(::current_path() / CPPAN_FILENAME))
473+
if (!fs::exists(current_thread_path() / CPPAN_FILENAME))
474474
throw std::runtime_error("No spec file found");
475475
}
476476

src/common/config.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ DECLARE_STATIC_LOGGER(logger, "config");
3838
Config::Config()
3939
{
4040
addDefaultProject();
41-
dir = ::current_path();
41+
dir = current_thread_path();
4242
}
4343

4444
Config::Config(const path &p, bool local)

src/common/package_store.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ PackageStore::read_packages_from_file(path p, const String &config_name, bool di
560560
LOG_INFO(logger, "Finding sources for " + project.pkg.ppath.slice(2).toString());
561561
project.findSources(root_directory);
562562
// maybe remove? let user see cppan.yml in local project
563-
project.files.erase(::current_path() / CPPAN_FILENAME);
563+
project.files.erase(current_thread_path() / CPPAN_FILENAME);
564564
project.files.erase(CPPAN_FILENAME);
565565
// patch if any
566566
project.patchSources();

src/common/project.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ void Project::findSources(path p)
569569

570570
// correct root dir is detected and set during load phase
571571
if (p.empty())
572-
p = ::current_path();
572+
p = current_thread_path();
573573
if (p != root_directory)
574574
p /= root_directory;
575575

@@ -733,8 +733,8 @@ void Project::findSources(path p)
733733
fs::copy_file(CPPAN_FILENAME, root_directory / CPPAN_FILENAME, fs::copy_option::overwrite_if_exists);
734734
if (fs::exists(p / CPPAN_FILENAME))
735735
files.insert(p / CPPAN_FILENAME);
736-
else if (fs::exists(::current_path() / CPPAN_FILENAME))
737-
files.insert(::current_path() / CPPAN_FILENAME);
736+
else if (fs::exists(current_thread_path() / CPPAN_FILENAME))
737+
files.insert(current_thread_path() / CPPAN_FILENAME);
738738
else
739739
files.insert(CPPAN_FILENAME);
740740
}
@@ -803,7 +803,7 @@ ProjectPath Project::relative_name_to_absolute(const String &name)
803803
optional<ProjectPath> Project::load_local_dependency(const String &name)
804804
{
805805
optional<ProjectPath> pp;
806-
if (allow_local_dependencies && (fs::exists(::current_path() / name) || isUrl(name)))
806+
if (allow_local_dependencies && (fs::exists(current_thread_path() / name) || isUrl(name)))
807807
{
808808
PackagesSet pkgs;
809809
Config c;
@@ -878,7 +878,7 @@ void Project::load(const yaml &root)
878878
{
879879
get_scalar_f(root, s, [&p, &s](const auto &n)
880880
{
881-
auto cp = ::current_path();
881+
auto cp = current_thread_path();
882882
p = n.template as<String>();
883883
if (!is_under_root(cp / p, cp))
884884
throw std::runtime_error("'" + s + "' must not point outside the current dir: " + p.string() + ", " + cp.string());
@@ -1274,8 +1274,8 @@ void Project::load(const yaml &root)
12741274
// to make some following default checks available
12751275
// try to detect and prepend root dir
12761276
{
1277-
auto root = is_local ? findRootDirectory() : ::current_path();
1278-
if (root_directory.empty() || !fs::exists(::current_path() / root_directory))
1277+
auto root = is_local ? findRootDirectory() : current_thread_path();
1278+
if (root_directory.empty() || !fs::exists(current_thread_path() / root_directory))
12791279
root_directory = root;
12801280
else if (root_directory != root)
12811281
root_directory = root / root_directory;

src/common/settings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void Settings::load(const yaml &root, const SettingsType type)
9999
switch (type)
100100
{
101101
case SettingsType::Local:
102-
return ::current_path();
102+
return current_thread_path();
103103
case SettingsType::User:
104104
case SettingsType::System:
105105
return dirs.storage_dir_tmp / "build";

src/common/source.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ void Git::download() const
224224
{
225225
String branchPath = url.substr(url.find_last_of("/") + 1);
226226
fs::create_directory(branchPath);
227-
ScopedCurrentPath scp(::current_path() / branchPath);
227+
ScopedCurrentPath scp(current_thread_path() / branchPath);
228228

229229
Command::execute({ "git", "init" });
230230
Command::execute({ "git", "remote", "add", "origin", url });
@@ -318,7 +318,7 @@ void Hg::download() const
318318
Command::execute({ "hg", "clone", url });
319319

320320
String branchPath = url.substr(url.find_last_of("/") + 1);
321-
ScopedCurrentPath scp(::current_path() / branchPath);
321+
ScopedCurrentPath scp(current_thread_path() / branchPath);
322322

323323
if (!tag.empty())
324324
Command::execute({ "hg", "update", tag });
@@ -386,7 +386,7 @@ void Bzr::download() const
386386
Command::execute({ "bzr", "branch", url });
387387

388388
String branchPath = url.substr(url.find_last_of("/") + 1);
389-
ScopedCurrentPath scp(::current_path() / branchPath);
389+
ScopedCurrentPath scp(current_thread_path() / branchPath);
390390

391391
if (!tag.empty())
392392
Command::execute({ "bzr", "update", "-r", "tag:" + tag });
@@ -452,7 +452,7 @@ void Fossil::download() const
452452
Command::execute({ "fossil", "clone", url, "temp.fossil" });
453453

454454
fs::create_directory("temp");
455-
ScopedCurrentPath scp(::current_path() / "temp");
455+
ScopedCurrentPath scp(current_thread_path() / "temp");
456456

457457
Command::execute({ "fossil", "open", "../temp.fossil" });
458458

src/printers/cmake.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ endif()
10611061

10621062
// should be after flags
10631063
config_section_title(ctx, "CPPAN include");
1064-
ctx.addLine("set(CPPAN_BUILD_OUTPUT_DIR \"" + normalize_path(::current_path() / s.output_dir) + "\")");
1064+
ctx.addLine("set(CPPAN_BUILD_OUTPUT_DIR \"" + normalize_path(current_thread_path() / s.output_dir) + "\")");
10651065
ctx.addLine("set(CPPAN_BUILD_SHARED_LIBS "s + (s.use_shared_libs ? "1" : "0") + ")");
10661066
ctx.addLine("set(CPPAN_DISABLE_CHECKS "s + (bs.disable_checks ? "1" : "0") + ")");
10671067
ctx.addLine("set(CPPAN_BUILD_VERBOSE "s + (s.build_system_verbose ? "1" : "0") + ")");
@@ -1157,7 +1157,7 @@ int CMakePrinter::generate(const BuildSettings &bs) const
11571157
{
11581158
if (!s.silent || s.is_custom_build_dir())
11591159
{
1160-
auto bld_dir = ::current_path();
1160+
auto bld_dir = current_thread_path();
11611161
#ifdef _WIN32
11621162
// add more != generators
11631163
if (s.generator != "Ninja")

src/support/filesystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ path get_temp_filename(const path &subdir = path());
3636
String get_stamp_filename(const String &prefix);
3737
String make_archive_name(const String &fn = String());
3838

39-
path findRootDirectory(const path &p = ::current_path());
39+
path findRootDirectory(const path &p = current_thread_path());

0 commit comments

Comments
 (0)