cozy-labs/cozy-desktop

View on GitHub
core/utils/path.js

Summary

Maintainability
A
0 mins
Test Coverage
/* @flow */

const path = require('path')

const localToRemote = (p /*: string */) /*: string */ =>
  path.posix.join(path.posix.sep, ...p.split(path.sep))

const remoteToLocal = (p /*: string */) /*: string */ =>
  p.startsWith(path.posix.sep)
    ? path.normalize(p.substring(1))
    : path.normalize(p)

module.exports = {
  localToRemote,
  remoteToLocal
}