From 54ba617229531e3be218362f71525b96070c9aeb Mon Sep 17 00:00:00 2001 From: hunbernd Date: Sun, 23 Oct 2016 20:42:59 +0200 Subject: [PATCH] Fix: unable to upload files on Windows Caused by multiple unneeded / character in file path. --- libretroshare/src/file_sharing/dir_hierarchy.cc | 6 +++--- libretroshare/src/file_sharing/directory_storage.cc | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/file_sharing/dir_hierarchy.cc b/libretroshare/src/file_sharing/dir_hierarchy.cc index 513ead3a5..07e395455 100644 --- a/libretroshare/src/file_sharing/dir_hierarchy.cc +++ b/libretroshare/src/file_sharing/dir_hierarchy.cc @@ -189,7 +189,7 @@ bool InternalFileHierarchyStorage::updateSubDirectoryList(const DirectoryStorage de->row = mNodes.size(); de->parent_index = indx; de->dir_modtime = 0;// forces parsing.it->second; - de->dir_parent_path = d.dir_parent_path + "/" + d.dir_name ; + de->dir_parent_path = RsDirUtil::makePath(d.dir_parent_path, d.dir_name) ; de->dir_hash = createDirHash(de->dir_name,d.dir_hash,random_hash_seed) ; mDirHashes[de->dir_hash] = mNodes.size() ; @@ -446,7 +446,7 @@ bool InternalFileHierarchyStorage::updateDirEntry(const DirectoryStorage::EntryI mNodes[dir_index] = de ; - de->dir_parent_path = d.dir_parent_path + "/" + dir_name ; + de->dir_parent_path = RsDirUtil::makePath(d.dir_parent_path, dir_name) ; de->dir_hash = subdirs_hash[i]; mDirHashes[subdirs_hash[i]] = dir_index ; @@ -696,7 +696,7 @@ public: inline virtual uint64_t file_size() const { return mFe.file_size ; } inline virtual const RsFileHash& file_hash() const { return mFe.file_hash ; } inline virtual time_t file_modtime() const { return mFe.file_modtime ; } - inline virtual std::string file_parent_path()const { return mDe.dir_parent_path + "/" + mDe.dir_name ; } + inline virtual std::string file_parent_path()const { return RsDirUtil::makePath(mDe.dir_parent_path, mDe.dir_name) ; } inline virtual uint32_t file_popularity() const { NOT_IMPLEMENTED() ; return 0; } private: diff --git a/libretroshare/src/file_sharing/directory_storage.cc b/libretroshare/src/file_sharing/directory_storage.cc index 6a4d3e93e..983846d9d 100644 --- a/libretroshare/src/file_sharing/directory_storage.cc +++ b/libretroshare/src/file_sharing/directory_storage.cc @@ -244,7 +244,7 @@ bool DirectoryStorage::extractData(const EntryIndex& indx,DirDetails& d) d.min_age = now - dir_entry->dir_most_recent_time ; d.age = now - dir_entry->dir_modtime ; d.name = dir_entry->dir_name; - d.path = dir_entry->dir_parent_path + "/" + dir_entry->dir_name ; + d.path = RsDirUtil::makePath(dir_entry->dir_parent_path, dir_entry->dir_name) ; d.parent = (void*)(intptr_t)dir_entry->parent_index ; if(indx == 0) @@ -268,7 +268,7 @@ bool DirectoryStorage::extractData(const EntryIndex& indx,DirDetails& d) const InternalFileHierarchyStorage::DirEntry *parent_dir_entry = mFileHierarchy->getDirEntry(file_entry->parent_index); if(parent_dir_entry != NULL) - d.path = parent_dir_entry->dir_parent_path + "/" + parent_dir_entry->dir_name + "/" ; + d.path = RsDirUtil::makePath(parent_dir_entry->dir_parent_path, parent_dir_entry->dir_name) ; else d.path = "" ; }