Skip to content

Commit 5e07f4f

Browse files
committed
Cleanup member function textual_context::proxy::resolve
Signed-off-by: yamacir-kit <httperror@404-notfound.jp>
1 parent a47ddbb commit 5e07f4f

File tree

4 files changed

+22
-23
lines changed

4 files changed

+22
-23
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ Then, select one of the following targets and `make` it according to your purpos
102102

103103
| Target | Description
104104
|-------------|-------------
105-
| `all` | Build shared-library `libmeevax.0.5.444.so` and executable `meevax`.
105+
| `all` | Build shared-library `libmeevax.0.5.445.so` and executable `meevax`.
106106
| `install` | Copy files into `/usr/local` directly.
107-
| `package` | Generate debian package `meevax_0.5.444_amd64.deb` (only Ubuntu). The generated package can be installed by `sudo apt install build/meevax_0.5.444_amd64.deb`.
107+
| `package` | Generate debian package `meevax_0.5.445_amd64.deb` (only Ubuntu). The generated package can be installed by `sudo apt install build/meevax_0.5.445_amd64.deb`.
108108
| `test` | Test executable `meevax`. This target requires Valgrind to be installed.
109109
| `uninstall` | Remove files copied to `/usr/local` directly by target `install`.
110110

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.444
1+
0.5.445

src/kernel/environment.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,10 @@ namespace meevax::inline kernel
205205
{
206206
return std::get<1>(*iterator).as<library>().import_set();
207207
}
208-
209-
throw error(make<string>("No such library"), form);
208+
else
209+
{
210+
throw error(make<string>("No such library"), form);
211+
}
210212
}
211213
}
212214

src/kernel/textual_context.cpp

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,36 +38,33 @@ namespace meevax::inline kernel
3838
return source_file().parent_path();
3939
}
4040

41-
auto textual_context::proxy::resolve(std::filesystem::path const& pathname) const -> std::filesystem::path
41+
auto textual_context::proxy::resolve(std::filesystem::path const& given) const -> std::filesystem::path
4242
{
43-
if (pathname.is_absolute())
43+
if (std::filesystem::exists(given))
4444
{
45-
return pathname;
45+
return std::filesystem::canonical(given);
4646
}
47-
48-
if (auto directory = source_directory(); not directory.empty())
47+
else if (auto p = source_directory() / given; std::filesystem::exists(p))
4948
{
50-
if (auto p = directory / pathname; std::filesystem::exists(p))
51-
{
52-
return p;
53-
}
49+
return p;
5450
}
55-
56-
if (auto p = std::filesystem::current_path() / pathname; std::filesystem::exists(p))
51+
else if (auto p = std::filesystem::current_path() / given; std::filesystem::exists(p))
5752
{
5853
return p;
5954
}
60-
61-
for (auto const& directory : configurator::directories)
55+
else
6256
{
63-
if (auto p = directory / pathname; std::filesystem::exists(p))
57+
for (auto const& directory : configurator::directories)
6458
{
65-
return p;
59+
if (auto p = directory / given; std::filesystem::exists(p))
60+
{
61+
return p;
62+
}
6663
}
67-
}
6864

69-
throw error(make<string>("No such file"),
70-
make<string>(pathname));
65+
throw error(make<string>("No such file"),
66+
make<string>(given));
67+
}
7168
}
7269

7370
auto textual_context::cons(object const& a, object const& b, std::filesystem::path const& path) -> object

0 commit comments

Comments
 (0)