显示选中的文件或者当前目录的属性
334574
def on_props_activated(self, menu_item):
        ''''''
        tree_paths = self.iconview.get_selected_items()
        if not tree_paths:
            dialog = FolderPropertyDialog(self, self.app, self.parent.path)
            dialog.run()
            dialog.destroy()
        else:
            for tree_path in tree_paths:
                pcs_file = self.get_pcs_file(tree_path)
                dialog = PropertiesDialog(self.parent, self.app, pcs_file)
                dialog.run()
                dialog.destroy()
1049340
def setup_dir(f):
    ''' 
    '''
    setup_dir = os.path.dirname(os.path.abspath(__file__))

    def wrapped(*args, **kwargs):
        with chdir(setup_dir):
            return f(*args, **kwargs)

    return wrapped
931549
function(callback) {
		var self = this;
		var sections = [Path.join("/")];
		var paths_to_traverse = [];

		var should_exclude = function(entry) {
			return entry[0] === "." || entry[0] === "_" || entry === "shared";
		};

		var traverse_path = function() {
			var current_path = paths_to_traverse.shift() || "";
			Fs.readdir(Path.join(self.contentDir, current_path), function(err, entries) {
				if (err) {
					throw err;
				}

				var run_callbacks = function() {
					if (entries.length) {
						return next_entry();
					} else if (paths_to_traverse.length) {
						return traverse_path();
					} else {
						return callback(sections);
					}
				};

				var next_entry = function() {
					var current_entry = entries.shift();
					if (should_exclude(current_entry)) {
						return run_callbacks();
					}

					var current_entry_path = Path.join(current_path, current_entry);
					Fs.stat(Path.join(self.contentDir, current_entry_path), function(err, stat) {
						if (err) {
							return run_callbacks();
						}

						if (stat.isDirectory()) {
							sections.push(Path.join("/",current_entry_path));
							paths_to_traverse.push(current_entry_path);
						}

						return run_callbacks();
					});
				};

				return run_callbacks();
			});
		};
		return traverse_path();
	}
1272453
function getBaesVsersion(dir, callBack) {
        fs.readdir(`${dir}/`, (err, files) => {
            let dirList = [],
                baseVersion;
            if (err) {
                console.log('第一次部署中...');
                fs.mkdir(dir, () => {
                    callBack([1, 1, 1]);
                });
            } else {
                if (files.length == 0) {
                    files = ['1.1.1'];
                }
                console.log('部署目标已存在，正在更新中...');
                files.forEach((v)=> {
                    let intV = v.replace(/\./g, '');
                    if (!!parseInt(intV)) {
                        dirList.push(intV);
                    }
                });
                baseVersion = Math.max.apply(null, dirList).toString().split('');
                callBack(baseVersion);
            }
        });
    }
824286
function walk(path, floor, handleFile) {
	handleFile(path, floor);
	floor++;
	fs.readdir(path, function(err, files) {
		if (err) {
			console.log('read dir error');
		} else {
			files.forEach(function(item) {
				var tmpPath = path + '/' + item;
				fs.stat(tmpPath, function(err1, stats) {
					if (err1) {
						console.log('stat error');
					} else {
						if (stats.isDirectory()) {
							walk(tmpPath, floor, handleFile);
						} else {
							handleFile(tmpPath, floor);
						}
					}
				})
			});

		}
	});
}
408301
async function scanFile (dir, ext, ret_absolute)
{
return new Promise( async function(resolve, reject){
    // console.log(dir);
    fs.readdir(dir, function(err, files){
        let file_arr = [];
        if( ! files ){
            return resolve(file_arr);
        }
        files.forEach(function(elm){
            if( elm.indexOf('.') > -1 ){
                if( !ext || '.'+ext.toUpperCase()==path.extname(elm).toUpperCase() ){
                    // 返回全路径
                    if( ret_absolute ){
                        elm = path.join(dir, elm);
                    }
                    // 检查文件后缀名
                    file_arr.push(elm);
                }
            }
        });
        resolve(file_arr);
    });
});
}
367037
function formatPath(filePath, root) {
  let dir = root;

  if (!path.isAbsolute(root)) {
    dir = path.join(process.cwd(), root);
  }

  // 修复windows下的\路径问题
  dir = dir.replace(/\\/g, '/');

  return filePath
    .replace(/\\/g, '/')
    .replace(dir, '')
    .split('.')[0];
}
1280924
def list_files(path, extension=".cpp", exclude="S.cpp"):
    """"""
    return ["%s/%s" % (path, f) for f in listdir(path) if f.endswith(extension) and (not f.endswith(exclude))]
398156
function combineFileContent(pkg, toMergeFiles, context) {
    var content = '';
    var has = [];
    var isPackBundles = !! pkg.isPackBundles;
    toMergeFiles.forEach(function (file) {
        has.push(file.id);
        if(isPackBundles){
            if(file.packBundlesTo){
                fis.log.error('file [%s] has packBundlesTo[%s],can not packBundles more than once!',file.id,pkg.id);
                return;
            }
            file.packBundlesTo = pkg.subpath;
        }
        // 把要合并的文件的依赖信息添加到打包文件里
        addDependenceResource(pkg, 'addLink', file.links,context);
        addDependenceResource(pkg, 'addRequire', file.requires,context);
        addDependenceResource(pkg, 'addAsyncRequire', file.asyncs,context);

        var c;
        if(!isPackBundles && file.packBundlesTo){
            //已经合并在Bundles里面的模块不用打包到pkg里面，只需要pathmap里设置为Bundles文件的moduleId即可
            c = '';
        }else{
            c = file.getContent();
        }

        
       /* if (c && file.isCssLike && file !== pkg) {
            c = updateCSSContentUrl(c, file, pkg, context);
        }*/

        if (c) {
            if (file.isCssLike) {
                c = c.replace(CSS_CHARSET_REGEXP, '');
            }

            /**
             * @event pack:file 触发打包事件
             */
            fis.emit('pack:file', {
                file: file,
                content: c,
                pkg: pkg
            });

            content += c + '\n';
        }
    });

    return {
        content: content,
        has: has
    };
}
920878
def ListDirectoryAbsolute(directory):
  """"""
  return (os.path.join(directory, path)
          for path in tf.io.gfile.listdir(directory))
129258
function ( src, dst ){
      // 读取目录中的所有文件/目录
      fs.readdir( src, function ( err, paths ){
          if( err ){
              throw err;
          }

          paths.forEach(function ( path ){
              var _src = src + '/' + path,
                  _dst = dst + '/' + path,
                  readable, writable;
              fs.stat( _src, function ( err, st ){
                  if( err ){
                      throw err;
                  }
                  // 判断是否为文件
                  if( st.isFile() ){
                      // 创建读取流
                      readable = fs.createReadStream( _src );
                      // 创建写入流
                      writable = fs.createWriteStream( _dst );
                      // 通过管道来传输流
                      readable.pipe( writable );
                  }
                  // 如果是目录则递归调用自身
                  else if( st.isDirectory() ){
                      exists( _src, _dst, copy );
                  }
              });
          });
      });
  }
1000157
function readMainFiles(path, files) {
		fs.readdirSync(path).forEach(function (filename) {
			var file = path+'/'+filename;
			if (filename.slice(-3)==='.js') {
				files.push(file.slice(prj_path_len + 5)); //把“main/”也去掉
			} else if (filename[0]!=='.' && fs.statSync(file).isDirectory()) {
				//排除.svn，.github之类的文件夹
				readMainFiles(file, files);
				//在构建目录的main和min里创建对应的目录
				file = file.slice(prj_path_len + 5)+'/';
				util.mkdir(path_main, file);
				util.mkdir(path_min, file);
				boot_js || util.mkdir(path_tag, file);
			}
		});
	}
985208
function(callback) {
            if (!file.isDirectory()) {
              callback();
              return;
            }

            grunt.log.write(wrap('d--------- /' + file.dest));
            ftpout.raw.mkd(file.dest, function(err) {
              if (err) {
                if (err.code != 550) {
                  done(err);
                } else {
                  grunt.log.writeln(wrapRight('[PRESENT]').yellow);
                }
              } else {
                grunt.log.writeln(wrapRight('[SUCCESS]').green);
              }
              callback();
            });
          }
156488
def do_cat(self, path):
        """"""
        path = path[0]
        tmp_file_path = self.TMP_PATH + 'tmp'

        if not os.path.exists(self.TMP_PATH):
            os.makedirs(self.TMP_PATH)

        f = self.n.downloadFile(self.current_path + path, tmp_file_path)
        f = open(tmp_file_path, 'r')

        self.stdout.write(f.read())
        self.stdout.write("\n")
1072995
function getPathToRoot(filePath) {
	filePath = filePath.replace(/\\/g, "/");

	var lastSlash = filePath.lastIndexOf("/");
	// strip out file name from the path
	filePath = lastSlash >= 0 ? filePath.slice(0, lastSlash + 1) : "";

	if (!filePath) {
		return "";
	}
    // now "folder1/folder2/file.ext" became "folder1/folder2/"
	filePath = filePath.replace(/[^/]+/g, "..");
	if (filePath.charAt(0) === "/") {
		filePath = filePath.slice(1);
	}
	return filePath;
}
891054
def staticdir():
    """"""
    root = os.path.abspath(os.path.dirname(__file__))
    return os.path.join(root, "static")
1345750
def O
      dir = current_item.directory? ? current_item.path : current_dir.path
      system %Q[osascript -e 'tell app "Terminal"
        do script "cd #{dir}"
      end tell'] if osx?
    end