-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Hello everyone,
first off my setup:
codeviz based off commit a7aed10
Python 3.12.3
WSL2/Ubuntu 24.04 Linux INV-12047 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
When I try to run codeviz and pass it either a relative path that contains a "../" to a a directory on the same level as the current working directory (CWD) or is an absolute path to said same directory, codeviz states that the path does not exist.
Running codeviz in verbose mode shows, that the path is resolved to an absolute path, but for some reason the leading "/" is missing.
A minimal example:
Project Structure
$ tree .
├── base
│ ├── Makefile
│ └── src
│ └── main.c
├── first
│ ├── inc
│ │ └── firstFile.h
│ └── src
│ └── firstFile.c
└── second
└── src
└── secondFile.cI can then recreate the error with
$ cd ./base
$ codeviz --verbose -r ./src ../first/inc/ ../second/src/ -o graph.svg
Found files:
first/inc/firstFile.h
second/src/secondFile.c
src/main.c
Traceback (most recent call last):
File "/home/myuser/bin/codeviz", line 363, in <module>
retcode = main()
^^^^^^
File "/home/myuser/bin/codeviz", line 346, in main
nodes = get_nodes(files, highlight_files, force_include=args.must_include)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/myuser/bin/codeviz", line 117, in get_nodes
n = Node(f)
^^^^^^^
File "/home/myuser/bin/codeviz", line 65, in __init__
self.file = File(filepath)
^^^^^^^^^^^^^^
File "/home/myuser/bin/codeviz", line 47, in __init__
self.included_headers = self._get_included_headers()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/myuser/bin/codeviz", line 52, in _get_included_headers
with open(self.path, 'rt') as f:
^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'first/inc/firstFile.h'
make: *** [Makefile:3: createDepsGraph] Error 1So, codeviz finds the different source files, lists them, but has stripped the relative move upwards with "../". Then it fails as there is no first/ or second/ directory under base/.
Using an absolute path makes this even more obvious that something seems to be removed from the beginning:
$ cd ./base
$ codeviz --verbose -r ./src /home/myuser/workspace/ccpp_proj/tester_project/first/inc/ ../second/src/ -o graph.svg
Found files:
home/myuser/workspace/ccpp_proj/tester_project/first/inc/firstFile.h
second/src/secondFile.c
src/main.c
Traceback (most recent call last):
File "/home/myuser/bin/codeviz", line 363, in <module>
retcode = main()
^^^^^^
File "/home/myuser/bin/codeviz", line 346, in main
nodes = get_nodes(files, highlight_files, force_include=args.must_include)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/myuser/bin/codeviz", line 117, in get_nodes
n = Node(f)
^^^^^^^
File "/home/myuser/bin/codeviz", line 65, in __init__
self.file = File(filepath)
^^^^^^^^^^^^^^
File "/home/myuser/bin/codeviz", line 47, in __init__
self.included_headers = self._get_included_headers()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/myuser/bin/codeviz", line 52, in _get_included_headers
with open(self.path, 'rt') as f:
^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'home/myuser/workspace/ccpp_proj/tester_project/first/inc/firstFile.h'