Ktt-Development/simplehttpserver

Drives do not have file names

Katsute opened this issue · 1 comments

Prerequisites

If all checks are not passed then the issue will be closed

  • I have checked that no other similar issue already exists

Operating System: Operating system name and version
Windows 10

Release Version: Release version or branch where the issue occurred
03.05.04

Issue

Explain your issue. Add any screenshots here

When adding a directory that is a root there is a null file name.

Expected Behavior

Explain what was supposed to happen

Root directory should return directory name.

Steps To Reproduce

Explain how and/or when the error occurred

These methods may return null on #getName() when a drive is supplied.


addDirectory("",directory,directory.getName(),ByteLoadingOption.LIVELOAD,false);

addDirectory("",directory,directory.getName(),ByteLoadingOption.LIVELOAD,walk);

addDirectory("",directory,directory.getName(),loadingOption,false);

addDirectory("",directory,directory.getName(),loadingOption,walk);

addDirectory(context,directory,directory.getName(),ByteLoadingOption.LIVELOAD,false);

addDirectory(context,directory,directory.getName(),ByteLoadingOption.LIVELOAD,walk);

addDirectory(context,directory,directory.getName(),loadingOption,false);

addDirectory(context,directory,directory.getName(),loadingOption,walk);

File#getParentFile can be used to detect roots.
If it is a root directory then it returns null because there is no parent.
FIle#getPath() can then be used as the name instead since only the directory should be part of the path.