mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-19 01:28:38 +02:00
refactor(utils): categorize functions into separate files (#6773)
This commit is contained in:
parent
908ad52025
commit
670f2e5268
13 changed files with 928 additions and 886 deletions
|
@ -5,10 +5,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// Based on https://github.com/gatsbyjs/gatsby/pull/21518/files
|
||||
|
||||
import path from 'path';
|
||||
|
||||
// Based on https://github.com/gatsbyjs/gatsby/pull/21518/files
|
||||
// MacOS (APFS) and Windows (NTFS) filename length limit = 255 chars,
|
||||
// Others = 255 bytes
|
||||
const MAX_PATH_SEGMENT_CHARS = 255;
|
||||
|
@ -113,3 +112,10 @@ export function escapePath(str: string): string {
|
|||
// Remove the " around the json string;
|
||||
return escaped.substring(1, escaped.length - 1);
|
||||
}
|
||||
|
||||
export function addTrailingPathSeparator(str: string): string {
|
||||
return str.endsWith(path.sep)
|
||||
? str
|
||||
: // If this is Windows, we need to change the forward slash to backward
|
||||
`${str.replace(/\/$/, '')}${path.sep}`;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue