-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Backup now supports uploading files and folders
- Loading branch information
1 parent
20bd288
commit f5568c8
Showing
14 changed files
with
124 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,29 @@ | ||
import path from 'path'; | ||
|
||
export function relative(root: string, to: string): string { | ||
const r = path.posix.relative(root, to); | ||
const normalizedTo = to.replace(/^[/\\]+/, ''); | ||
|
||
return r.startsWith('/') ? r : `/${r}`; | ||
// Unir 'root' con la ruta normalizada | ||
const resolvedPath = path.resolve(root, normalizedTo); | ||
|
||
return resolvedPath; | ||
} | ||
export function relativeV2(root: string, to: string): string { | ||
// Obtener la ruta relativa de 'to' respecto a 'root' | ||
const relativePath = path.relative(root, to); | ||
|
||
// Asegurar que la ruta empiece con una barra inclinada | ||
return `/${relativePath.replace(/\\/g, '/')}`; | ||
} | ||
export function getParentDirectory(root: string, filePath: string): string { | ||
// Obtener la ruta relativa del archivo en relación al root | ||
const relativePath = path.relative(root, filePath); | ||
|
||
// Obtener el directorio padre | ||
const parentDirectory = path.dirname(relativePath); | ||
|
||
// Asegurar que la ruta empiece con una barra inclinada | ||
return parentDirectory === '.' | ||
? '/' | ||
: `/${parentDirectory.replace(/\\/g, '/')}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters