RTEditor/src/main/java/com/onegravity/rteditor/utils/io/FilenameUtils.java
public static String normalizeNoEndSeparator(String filename, boolean unixSeparator) {
         char separator = unixSeparator ? UNIX_SEPARATOR : WINDOWS_SEPARATOR;
        return doNormalize(filename, separator, false);
    }
public static String normalizeNoEndSeparator(String filename, boolean unixSeparator) {
         char separator = unixSeparator ? UNIX_SEPARATOR : WINDOWS_SEPARATOR;
        return doNormalize(filename, separator, false);
    }
public static String normalizeNoEndSeparator ( String filename , boolean unixSeparator ) { char separator = unixSeparator ? UNIX_SEPARATOR : WINDOWS_SEPARATOR ; return doNormalize ( filename , separator , false ) ; }
Normalizes a path, removing double and single dot path steps,
and removing any final directory separator.
<p>
This method normalizes a path to a standard format.
The input may contain separators in either Unix or Windows format.
The output will contain separators in the format specified.
<p>
A trailing slash will be removed.
A double slash will be merged to a single slash (but UNC names are handled).
A single dot path segment will be removed.
A double dot will cause that path segment and the one before to be removed.
If the double dot has no parent path segment to work with, {@code null}
is returned.
<p>
The output will be the same on both Unix and Windows including
the separator character.
<pre>
/foo//               -->   /foo
/foo/./              -->   /foo
/foo/../bar          -->   /bar
/foo/../bar/         -->   /bar
/foo/../bar/../baz   -->   /baz
//foo//./bar         -->   /foo/bar
/../                 -->   null
../foo               -->   null
foo/bar/..           -->   foo
foo/../../bar        -->   null
foo/../bar           -->   bar
//server/foo/../bar  -->   //server/bar
//server/../bar      -->   null
C:\foo\..\bar        -->   C:\bar
C:\..\bar            -->   null
~/foo/../bar/        -->   ~/bar
~/../bar             -->   null
</pre>

@param filename  the filename to normalize, null returns null
@param unixSeparator {@code true} if a unix separator should
be used or {@code false} if a windows separtor should be used.
@return the normalized filename, or null if invalid
@since 2.0
Normalizes a path removing double and single dot path steps and removing any final directory separator . <p > This method normalizes a path to a standard format . The input may contain separators in either Unix or Windows format . The output will contain separators in the format specified . <p > A trailing slash will be removed . A double slash will be merged to a single slash ( but UNC names are handled ) . A single dot path segment will be removed . A double dot will cause that path segment and the one before to be removed . If the double dot has no parent path segment to work with { @code null } is returned . <p > The output will be the same on both Unix and Windows including the separator character . <pre > / foo // -- > / foo / foo / . / -- > / foo / foo / .. / bar -- > / bar / foo / .. / bar / -- > / bar / foo / .. / bar / .. / baz -- > / baz // foo // . / bar -- > / foo / bar / .. / -- > null .. / foo -- > null foo / bar / .. -- > foo foo / .. / .. / bar -- > null foo / .. / bar -- > bar // server / foo / .. / bar -- > // server / bar // server / .. / bar -- > null C : \ foo \ .. \ bar -- > C : \ bar C : \ .. \ bar -- > null ~ / foo / .. / bar / -- > ~ / bar ~ / .. / bar -- > null < / pre >