quiclog / pcap2qlog

A tool to convert .pcap and .pcapng files into qlog files
MIT License
26 stars 7 forks source link

Fixed mkdir flow for MacOS #2

Closed maxsharabayko closed 4 years ago

maxsharabayko commented 4 years ago

Independent from how the output directory is specified,

the script determines the absolute path, and then goes (MacOS):

Directory /
Directory /Users
Directory /Users/<username>
...

And throws the EISDIR error trying to create directory / on MacOS.

This PR adds two additional checks to the mkDirByPathSync(..) function.

  1. Add handling of "EISDIR".

  2. Create a directory only if the path does not exist. Using additional condition fs.existsSync(curDir)