benawad / destiny

Prettier for File Structures
MIT License
3.53k stars 80 forks source link

Different folder structure results in Windows vs Linux: missing src folder #142

Open andria-dev opened 4 years ago

andria-dev commented 4 years ago

When running the command yarn destiny ./src the results are different between Windows and Linux. Linux behaves as expected and organizes the files and directories inside of the src directory, whereas, Windows places the files at the root of the project.

My project file structure:

.
├── package.json
├── src
│   ├── App.css
│   ├── App.jsx
│   ├── index.html
│   ├── logo.svg
│   ├── main.jsx
│   └── styles.css
├── vite.config.js
└── yarn.lock

Linux result (works as expected):

INFO: Generating tree for: ./src
src
├──main
│  ├──App
│  │  ├──App.css
│  │  └──logo.svg
│  ├──App.jsx
│  └──styles.css
└──main.jsx

Windows result (very much not expected):

INFO: Generating tree for: ./src

├──main.jsx
├──main\App.jsx
├──main\App\App.css
├──main\App\logo.svg
└──main\styles.css

I think it for some reason just replaced src with nothing because the file structure is correct but it's simply not in the right place, however, it also displays weird as I wouldn't have expected the output of a tree to be flat.

Left: Ubuntu Subsystem - Bash Right: Windows 10 - Powershell Screenshots

AnatoleLucet commented 4 years ago

Destiny is moving every file out of src for the same reason as #135.

It seems like there's also an issue with the way that Destiny print the tree. I've tried to run destiny src -w using the build from #140 on a Vite React template and it correctly prettify the file structure, but the printed tree is the same as on your screenshot (except all the files were in the src folder).

andria-dev commented 4 years ago

@AnatoleLucet Yeah I just tried out that PR too (had to fork it to change npm build script to work when doing yarn add with a GitHub repo) and it fixed the src thing but yeah, is the tree generating thing just not recognizing the \ as a valid separator or something?

AnatoleLucet commented 4 years ago

is the tree generating thing just not recognizing the \ as a valid separator or something?

Probably only the printTree function which only print the generated tree. But yes, this might be it.