PathUtil was removed.
@@ -1,58 +0,0 @@ | ||
1 | -package jp.sf.amateras.rdiffbackup.util; | |
2 | - | |
3 | -import com.google.common.base.Strings; | |
4 | - | |
5 | -import javax.servlet.http.HttpServletRequest; | |
6 | - | |
7 | -/** | |
8 | - * ファイルやディレクトリのパスを操作するためのユーティリティです。 | |
9 | - * | |
10 | - * @author Naoki Takezoe | |
11 | - */ | |
12 | -public class PathUtil { | |
13 | - | |
14 | - /** | |
15 | - * パスから末尾のファイル名もしくはディレクトリ名部分を取得します。 | |
16 | - * | |
17 | - * @param path ファイルまたはディレクトリのパス | |
18 | - * @return ファイル名またはディレクトリ名 | |
19 | - * @deprecated TODO RDiffBackupをScalaに移行したらこのメソッドは不要になるので削除すること | |
20 | - */ | |
21 | - static String getFileName(String path){ | |
22 | - if(path.endsWith("/")){ | |
23 | - path = path.substring(0, path.length() - 1); | |
24 | - } | |
25 | - | |
26 | - int index = path.lastIndexOf('/'); | |
27 | - if(index >= 0){ | |
28 | - return path.substring(index + 1); | |
29 | - } | |
30 | - return null; | |
31 | - } | |
32 | - | |
33 | -// /** | |
34 | -// * ダウンロード用のファイル名を取得します。 | |
35 | -// * ブラウザの種類に応じて文字コードの変換を行います。 | |
36 | -// * | |
37 | -// * @param fileName ファイル名 | |
38 | -// * @return 文字コード変換後のファイル名 | |
39 | -// */ | |
40 | -// public static String getDownloadFileName(String fileName){ | |
41 | -// try { | |
42 | -// HttpServletRequest request = RequestUtil.getRequest(); | |
43 | -// | |
44 | -// String userAgent = request.getHeader("USER-AGENT"); | |
45 | -// if(userAgent != null){ | |
46 | -// if(userAgent.indexOf("MSIE") >= 0 && userAgent.indexOf("Opera") < 0){ | |
47 | -// fileName = new String(fileName.getBytes("Windows-31J"), "ISO8859_1"); | |
48 | -// } else { | |
49 | -// fileName = new String(fileName.getBytes("UTF-8"), "ISO8859_1"); | |
50 | -// } | |
51 | -// } | |
52 | -// return fileName; | |
53 | -// | |
54 | -// } catch(Exception ex){ | |
55 | -// throw new RuntimeException(ex); | |
56 | -// } | |
57 | -// } | |
58 | -} |
@@ -149,7 +149,7 @@ | ||
149 | 149 | tmpDir.mkdir(); |
150 | 150 | |
151 | 151 | ProcessBuilder builder = new ProcessBuilder(COMMAND, "-r", timestamp, path, |
152 | - new File(tmpDir, PathUtil.getFileName(path)).getAbsolutePath()); | |
152 | + new File(tmpDir, getFileName(path)).getAbsolutePath()); | |
153 | 153 | InputStream in = null; |
154 | 154 | |
155 | 155 | try { |
@@ -187,4 +187,22 @@ | ||
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | + /** | |
191 | + * パスから末尾のファイル名もしくはディレクトリ名部分を取得します。 | |
192 | + * | |
193 | + * @param path ファイルまたはディレクトリのパス | |
194 | + * @return ファイル名またはディレクトリ名 | |
195 | + */ | |
196 | + private static String getFileName(String path){ | |
197 | + if(path.endsWith("/")){ | |
198 | + path = path.substring(0, path.length() - 1); | |
199 | + } | |
200 | + | |
201 | + int index = path.lastIndexOf('/'); | |
202 | + if(index >= 0){ | |
203 | + return path.substring(index + 1); | |
204 | + } | |
205 | + return null; | |
206 | + } | |
207 | + | |
190 | 208 | } |