Commit c5f79f33 authored by Medicean's avatar Medicean

(BugFix:FileManager) 修复 Windows Shell 盘符小写引起的 bug

parent b134d3e2
......@@ -36,6 +36,8 @@ class Folder {
self.cache[_] = {};
self.tree.deleteItem(_);
});
// 移除根节点下的所有节点
self.tree.deleteChildItems(self.tree.rootId);
// 1. 分解当前路径
let curPath = '';
path.split('/').map((p) => {
......
......@@ -89,10 +89,13 @@ class FileManager {
};
let info_path = info[0].replace(/\\/g, '/').replace(/\.$/, '');
let info_drive = info[1];
// 判断是否为linux
if (info_path.substr(0, 1) === '/') {
this.isWin = false;
}else{
// windows 盘符统一大写
info_path = `${info_path.substr(0,1).toUpperCase()}${info_path.substr(1)}`;
info_drive = info_drive.toUpperCase();
};
this.path = info_path;
this.home = info_path;
......@@ -132,7 +135,14 @@ class FileManager {
getFiles(p, callback) {
let self = this;
if(self.isWin) { // 处理输入为 f:\ 这种情况
p = p.replace(/\\/g, '/').replace(/\.$/, '');
p = p.substr(1,2) == ":/" ? `${p.substr(0,1).toUpperCase()}${p.substr(1)}` : p;
}
let path = this.changePath(p);
if (self.isWin){ // 处理输入为 f: 这种情况
path = path.substr(1,2) == ":/" ? `${path.substr(0,1).toUpperCase()}${path.substr(1)}` : path;
}
let cache;
if (!path.endsWith('/')) { path += '/' };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment