mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-07 22:18:33 +00:00
Add gRPC support (#5148)
This commit is contained in:
@@ -9,4 +9,32 @@ const isWindowsOS = () => {
|
||||
|
||||
const brunoPath = isWindowsOS() ? path.win32 : path.posix;
|
||||
|
||||
const getRelativePath = (absolutePath, collectionPath) => {
|
||||
try {
|
||||
const relativePath = brunoPath.relative(collectionPath, absolutePath);
|
||||
return relativePath || absolutePath;
|
||||
} catch (error) {
|
||||
return absolutePath;
|
||||
}
|
||||
};
|
||||
|
||||
const getBasename = (filePath) => {
|
||||
if (!filePath) {
|
||||
return '';
|
||||
}
|
||||
const parts = filePath.split(path.sep);
|
||||
return parts[parts.length - 1];
|
||||
};
|
||||
|
||||
const getDirPath = (filePath) => {
|
||||
const parts = filePath.split(path.sep);
|
||||
parts.pop();
|
||||
return parts.join(path.sep);
|
||||
};
|
||||
|
||||
const getAbsoluteFilePath = (filePath, collectionPath) => {
|
||||
return brunoPath.resolve(collectionPath, filePath);
|
||||
};
|
||||
|
||||
export default brunoPath;
|
||||
export { getRelativePath, getBasename, getDirPath, getAbsoluteFilePath };
|
||||
|
||||
Reference in New Issue
Block a user