mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 18:58:30 +00:00
Update pathutil.rs
This commit is contained in:
parent
72c36bd3d2
commit
e7b7f99064
1 changed files with 4 additions and 0 deletions
|
@ -243,6 +243,7 @@ pub fn remove_verbatim(path: &Path) -> String {
|
|||
/// /users/foo/torch/src/lib.d.er -> torch
|
||||
/// foo/__pycache__/__init__.d.er -> foo
|
||||
/// math.d.er -> math
|
||||
/// foo.py -> foo
|
||||
/// ```
|
||||
/// FIXME: split by `.` instead of `/`
|
||||
pub fn mod_name(path: &Path) -> Str {
|
||||
|
@ -264,6 +265,7 @@ pub fn mod_name(path: &Path) -> Str {
|
|||
.trim_end_matches("lib.d.er")
|
||||
.trim_end_matches(".d.er")
|
||||
.trim_end_matches(".d")
|
||||
.trim_end_matches(".py")
|
||||
.to_string()
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
|
@ -290,6 +292,7 @@ pub fn mod_name(path: &Path) -> Str {
|
|||
c.trim_end_matches("lib.d.er")
|
||||
.trim_end_matches(".d.er")
|
||||
.trim_end_matches(".d")
|
||||
.trim_end_matches(".py")
|
||||
.to_string()
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
|
@ -303,6 +306,7 @@ pub fn mod_name(path: &Path) -> Str {
|
|||
.unwrap()
|
||||
.to_string_lossy()
|
||||
.trim_end_matches(".d.er")
|
||||
.trim_end_matches(".py")
|
||||
.to_string();
|
||||
let mut parents = path.components().rev().skip(1);
|
||||
while let Some(parent) = parents.next() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue