On Linux:
File: /home/user/somedir/myfile.txt
Dir: /home/user/
(result true
)
On Windows:
File: C:\SomeDir1\Dir2\Dir3\myfile.txt
Dir: C:\SomeDir1
(result true
)
File: C:\SomeDir1\Dir2\Dir3\myfile.txt
Dir: C:\SomeDir2\Dir3
(result false
)
So, I need to make sure if a specified file has a parent directory
I have an idea to implement it by converting to String and comparing it by characters, but in this case I need to replace all \
to /
and add /
in the end of directory if it's not here, I'm not sure if it's the best way, but not code monkey. Please advise