Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

Commit

Permalink
Merge pull request #444 from NebulousLabs/path-posix
Browse files Browse the repository at this point in the history
use path.posix for siapath manipulation for consistent windows behavior
  • Loading branch information
lukechampine authored Oct 25, 2016
2 parents 740e5d3 + f2a5e8e commit a40a454
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions plugins/Files/js/components/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const FileList = ({files, selected, searchResults, path, showSearchField, action
if (path === '') {
return
}
let newpath = Path.join(path, '../')
let newpath = Path.posix.join(path, '../')
if (newpath === './') {
newpath = ''
}
Expand Down Expand Up @@ -61,7 +61,7 @@ const FileList = ({files, selected, searchResults, path, showSearchField, action
const onDoubleClick = (e) => {
e.stopPropagation()
if (file.type === 'directory') {
actions.setPath(Path.join(path, file.name))
actions.setPath(Path.posix.join(path, file.name))
}
}
return (
Expand Down
2 changes: 1 addition & 1 deletion plugins/Files/js/sagas/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function* getWalletBalanceSaga() {
function* uploadFileSaga(action) {
try {
const filename = Path.basename(action.source)
const destpath = Path.join(action.siapath, filename)
const destpath = Path.posix.join(action.siapath, filename)
yield siadCall({
url: '/renter/upload/' + destpath,
method: 'POST',
Expand Down
6 changes: 3 additions & 3 deletions plugins/Files/js/sagas/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export const ls = (files, path) => {
let parsedFiles = Map()
fileList.forEach((file) => {
let type = 'file'
const relativePath = Path.relative(path, file.siapath)
let filename = Path.basename(relativePath)
const relativePath = Path.posix.relative(path, file.siapath)
let filename = Path.posix.basename(relativePath)
if (parsedFiles.has(filename)) {
return
}
Expand All @@ -78,7 +78,7 @@ export const ls = (files, path) => {
if (relativePath.indexOf('/') !== -1) {
type = 'directory'
filename = relativePath.split('/')[0]
siapath = Path.join(path, filename) + '/'
siapath = Path.posix.join(path, filename) + '/'
const subfiles = files.filter((subfile) => subfile.siapath.includes(siapath))
const totalFilesize = subfiles.reduce((sum, subfile) => sum + subfile.filesize, 0)
filesize = readableFilesize(totalFilesize)
Expand Down

0 comments on commit a40a454

Please sign in to comment.