| ... | ... | @@ -3892,10 +3892,17 @@ ZigType *add_source_file(CodeGen *g, ZigPackage *package, Buf *resolved_path, Bu |
| 3892 | 3892 | buf_init_from_buf(&namespace_name, &package->pkg_path); |
| 3893 | 3893 | if (source_kind == SourceKindNonRoot) { |
| 3894 | 3894 | assert(buf_starts_with_buf(resolved_path, &resolved_root_src_dir)); |
| 3895 | | |
| 3896 | | if (buf_len(&namespace_name) != 0) buf_append_char(&namespace_name, NAMESPACE_SEP_CHAR); |
| 3897 | | buf_append_mem(&namespace_name, buf_ptr(&noextname) + buf_len(&resolved_root_src_dir) + 1, |
| 3898 | | buf_len(&noextname) - (buf_len(&resolved_root_src_dir) + 1)); |
| 3895 | if (buf_len(&namespace_name) != 0) { |
| 3896 | buf_append_char(&namespace_name, NAMESPACE_SEP_CHAR); |
| 3897 | } |
| 3898 | // The namespace components are obtained from the relative path to the |
| 3899 | // source directory |
| 3900 | if (buf_len(&noextname) > buf_len(&resolved_root_src_dir)) { |
| 3901 | // Skip the trailing separator |
| 3902 | buf_append_mem(&namespace_name, |
| 3903 | buf_ptr(&noextname) + buf_len(&resolved_root_src_dir) + 1, |
| 3904 | buf_len(&noextname) - buf_len(&resolved_root_src_dir) - 1); |
| 3905 | } |
| 3899 | 3906 | buf_replace(&namespace_name, ZIG_OS_SEP_CHAR, NAMESPACE_SEP_CHAR); |
| 3900 | 3907 | } |
| 3901 | 3908 | Buf *bare_name = buf_alloc(); |