https://github.com/euberdeveloper/einsteinify
A pip moudle that transforms every C #include absolute path to a given directory to a relative path to the .c or .h file
https://github.com/euberdeveloper/einsteinify
Last synced: 3 months ago
JSON representation
A pip moudle that transforms every C #include absolute path to a given directory to a relative path to the .c or .h file
- Host: GitHub
- URL: https://github.com/euberdeveloper/einsteinify
- Owner: euberdeveloper
- License: mit
- Created: 2021-03-23T13:08:41.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-24T09:37:44.000Z (over 4 years ago)
- Last Synced: 2025-03-08T08:16:43.449Z (4 months ago)
- Language: Python
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# einsteinify
A pip moudle that transforms every C #include absolute path to a given directory to a relative path to the .c or .h file## Install
You can install einsteinify with pip:
```sh
$ pip install einsteinify
```## Project purpose
It may happen that you have a folder with `.c` and `.h` files where some the `#include "*.h"` are **global paths** to respect to the root folder. This module makes them **relative paths** to the root folder.
## Usage (global module)
```sh
$ einsteinify path/to/root/folder
```## Usage (local module)
```python
from einsteinify import einsteinifyPATH = 'path/to/root/folder'
einsteinify(PATH)
```## Result
Suppose that you have a directory like this:
```
root
├── main.h
├── other.h
├─> services
│ └── services.h
└─> utils
└── utils.h
```Where initially:
**main.h**
```c
#include "root/other.h"
#include "root/services/services.h"
```**other.h**
```c
#include "root/utils/utils.h"
```**utils.h**
```c
#include "root/other.h"
#include "root/services/services.h"
```After running **einsteinify** the includes would be:
**main.h**
```c
#include "./other.h"
#include "./services/services.h"
```**other.h**
```c
#include "./utils/utils.h"
```**utils.h**
```c
#include "../other.h"
#include "../services.h"
```