diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-10-10 08:07:44 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-10-10 08:07:44 +0800 |
commit | a377ca4de6418247b7715c670e604a8008d548c2 (patch) | |
tree | 3a69667201e3f3a2303814b61bd5bc1a95b67141 /tools/minicargo/manifest.cpp | |
parent | 08947889927447a8b02d936bd86637f7d861556f (diff) | |
download | mrust-a377ca4de6418247b7715c670e604a8008d548c2.tar.gz |
Minicargo Manifest - Tweaked binary source file logic
Diffstat (limited to 'tools/minicargo/manifest.cpp')
-rw-r--r-- | tools/minicargo/manifest.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/minicargo/manifest.cpp b/tools/minicargo/manifest.cpp index 5734e828..8c0a7f44 100644 --- a/tools/minicargo/manifest.cpp +++ b/tools/minicargo/manifest.cpp @@ -323,7 +323,7 @@ PackageManifest PackageManifest::load_from_toml(const ::std::string& path) // No library, add one pointing to lib.rs if( ::std::ifstream(package_dir / "src" / "main.rs").good() ) { - DEBUG("- Implicit library"); + DEBUG("- Implicit binary"); rv.m_targets.push_back(PackageTarget { PackageTarget::Type::Bin }); } } @@ -343,8 +343,13 @@ PackageManifest PackageManifest::load_from_toml(const ::std::string& path) tgt.m_path = "src/main.rs"; } else { - // TODO: What about src/bin/foo/main.rs? + // TODO: Error if both exist + // TODO: More complex search rules tgt.m_path = ::helpers::path("src") / "bin" / tgt.m_name.c_str() + ".rs"; + if( !::std::ifstream(package_dir / tgt.m_path).good() ) + tgt.m_path = ::helpers::path("src") / "bin" / tgt.m_name.c_str() / "main.rs"; + //if( !::std::ifstream(package_dir / tgt.m_path).good() ) + // throw ::std::runtime_error(format("Unable to find source file for ", tgt.m_name, " - ", package_dir / tgt.m_path)); } break; case PackageTarget::Type::Test: |