diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-03-07 09:06:37 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-03-07 09:06:37 +0200 |
commit | 1845141809aa91b03718066a6f46863885a6a887 (patch) | |
tree | a3f542ec7c1781e65aa16a9b0d5c31eae4c4d757 /build2/filesystem.cxx | |
parent | e0002617846755fb5f199f40a677e16d6f69e5ec (diff) |
Add support for alternative build file/directory naming scheme
Now the build/*.build, buildfile, and .buildignore filesystem entries in
a project can alternatively (but consistently) be called build2/*.build2,
build2file, and .build2ignore. See a note at the beginning of the Project
Structure section in the manual for details (motivation, restrictions,
etc).
Diffstat (limited to 'build2/filesystem.cxx')
-rw-r--r-- | build2/filesystem.cxx | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/build2/filesystem.cxx b/build2/filesystem.cxx index fc34d4d..97f540b 100644 --- a/build2/filesystem.cxx +++ b/build2/filesystem.cxx @@ -190,17 +190,15 @@ namespace build2 } } - const path buildignore_file (".buildignore"); - fs_status<mkdir_status> - mkdir_buildignore (const dir_path& d, uint16_t verbosity) + mkdir_buildignore (const dir_path& d, const path& n, uint16_t verbosity) { fs_status<mkdir_status> r (mkdir (d, verbosity)); // Create the .buildignore file if the directory was created (and so is // empty) or the file doesn't exist. // - path p (d / buildignore_file); + path p (d / n); if (r || !exists (p)) touch (p, true /* create */, verbosity); @@ -208,7 +206,7 @@ namespace build2 } bool - empty_buildignore (const dir_path& d) + empty_buildignore (const dir_path& d, const path& n) { try { @@ -217,8 +215,7 @@ namespace build2 // The .buildignore filesystem entry should be of the regular file // type. // - if (de.path () != buildignore_file || - de.ltype () != entry_type::regular) + if (de.path () != n || de.ltype () != entry_type::regular) return false; } } @@ -231,7 +228,7 @@ namespace build2 } fs_status<rmdir_status> - rmdir_buildignore (const dir_path& d, uint16_t verbosity) + rmdir_buildignore (const dir_path& d, const path& n, uint16_t verbosity) { // We should remove the .buildignore file only if the subsequent rmdir() // will succeed. In other words if the directory stays after the function @@ -239,13 +236,13 @@ namespace build2 // first check that the directory is otherwise empty and doesn't contain // the working directory. // - path p (d / buildignore_file); - if (exists (p) && empty_buildignore (d) && !work.sub (d)) + path p (d / n); + if (exists (p) && empty_buildignore (d, n) && !work.sub (d)) rmfile (p, verbosity); - // Note that in case of a system error the directory is likely to stay and - // the .buildfile is already removed. Trying to restore it feels like an - // overkill here. + // Note that in case of a system error the directory is likely to stay with + // the .buildignore file already removed. Trying to restore it feels like + // an overkill here. // return rmdir (d, verbosity); } |