MCPcopy Create free account
hub / github.com/diyhi/bbs / toRelativePath

Method toRelativePath

src/main/java/cms/utils/FileUtil.java:385–392  ·  view source on GitHub ↗

替换路径中的相对路径为横杆(如: file/../f/替换为file/-/f/) @param path 路径

(String path)

Source from the content-addressed store, hash-verified

383 * @param path 路径
384 */
385 public static String toRelativePath(String path){
386 String systemPath = "";
387 if(path != null && !path.trim().isEmpty()){
388 systemPath = Strings.CS.replace(path, "..", "-");
389 systemPath = Strings.CS.replace(systemPath, "%", "-");//百分号替换为横杆
390 }
391 return systemPath;
392 }
393
394 /**
395 * 系统路径转为下划线(如: file/f/f/转为file_f_f_)

Callers 15

unZipMethod · 0.95
downloadMethod · 0.95
filePackMethod · 0.95
deleteLockMethod · 0.95
deleteTopicFileMethod · 0.95
deleteCommentFileMethod · 0.95
deleteQuestionFileMethod · 0.95
deleteAnswerFileMethod · 0.95
editLinkMethod · 0.95
deleteLinkMethod · 0.95
handleFileUploadMethod · 0.95
deleteExportMethod · 0.95

Calls 2

isEmptyMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected