@@ 1303,15 1303,16 @@ minibuffer, even without explicitly focusing it."
(defun file-path-to-namespace ()
(interactive)
- (let ((root (file-name-directory (find-current-csproj)))
- (base (file-name-nondirectory buffer-file-name))
- (project-name (extract-project-name)))
+ (let* ((root (file-name-directory (find-current-csproj)))
+ (base (file-name-nondirectory buffer-file-name))
+ (project-name (extract-project-name))
+ (subdirectory
+ (replace-regexp-in-string "/" "\." (substring buffer-file-name (length root) (* -1 (length base))) t t)))
(concat
project-name
- "."
- (substring
- (replace-regexp-in-string "/" "\." (substring buffer-file-name (length root) (* -1 (length base))) t t)
- 0 -1)))))
+ (if (string= "" subdirectory)
+ ""
+ (concat "." (substring subdirectory 0 -1)))))))
;; Sh, Bash