リビジョン | 66 (tree) |
---|---|
日時 | 2018-03-08 19:36:23 |
作者 | hirukawa_ryo |
* hammer-markdown 0.7.6
リソースのコピーでNoSuchFileExceptionが発生しても無視するようにしました。
@@ -8,6 +8,7 @@ | ||
8 | 8 | import java.io.Writer; |
9 | 9 | import java.nio.charset.Charset; |
10 | 10 | import java.nio.file.Files; |
11 | +import java.nio.file.NoSuchFileException; | |
11 | 12 | import java.nio.file.StandardCopyOption; |
12 | 13 | import java.util.ArrayList; |
13 | 14 | import java.util.HashMap; |
@@ -128,8 +129,12 @@ | ||
128 | 129 | for(File srcFile : list) { |
129 | 130 | File dstFile = new File(srcFile.getCanonicalPath().replace(srcCanonicalPath, dstCanonicalPath)); |
130 | 131 | if(!dstFile.exists() || dstFile.length() != srcFile.length() || dstFile.lastModified() != srcFile.lastModified()) { |
131 | - dstFile.getParentFile().mkdirs(); | |
132 | - Files.copy(srcFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES); | |
132 | + try { | |
133 | + dstFile.getParentFile().mkdirs(); | |
134 | + Files.copy(srcFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES); | |
135 | + } catch(NoSuchFileException e) { | |
136 | + //気にしない。 | |
137 | + } | |
133 | 138 | } |
134 | 139 | } |
135 | 140 | } |
@@ -8,6 +8,7 @@ | ||
8 | 8 | import java.io.Writer; |
9 | 9 | import java.nio.charset.Charset; |
10 | 10 | import java.nio.file.Files; |
11 | +import java.nio.file.NoSuchFileException; | |
11 | 12 | import java.nio.file.StandardCopyOption; |
12 | 13 | import java.time.ZoneOffset; |
13 | 14 | import java.util.ArrayList; |
@@ -364,8 +365,12 @@ | ||
364 | 365 | for(File srcFile : list) { |
365 | 366 | File dstFile = new File(srcFile.getCanonicalPath().replace(srcCanonicalPath, dstCanonicalPath)); |
366 | 367 | if(!dstFile.exists() || dstFile.length() != srcFile.length() || dstFile.lastModified() != srcFile.lastModified()) { |
367 | - dstFile.getParentFile().mkdirs(); | |
368 | - Files.copy(srcFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES); | |
368 | + try { | |
369 | + dstFile.getParentFile().mkdirs(); | |
370 | + Files.copy(srcFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES); | |
371 | + } catch(NoSuchFileException e) { | |
372 | + //気にしなし。 | |
373 | + } | |
369 | 374 | } |
370 | 375 | } |
371 | 376 | } |
@@ -11,6 +11,7 @@ | ||
11 | 11 | import java.io.Writer; |
12 | 12 | import java.nio.charset.Charset; |
13 | 13 | import java.nio.file.Files; |
14 | +import java.nio.file.NoSuchFileException; | |
14 | 15 | import java.nio.file.Path; |
15 | 16 | import java.nio.file.StandardCopyOption; |
16 | 17 | import java.util.ArrayList; |
@@ -225,8 +226,12 @@ | ||
225 | 226 | for(File srcFile : list) { |
226 | 227 | File dstFile = new File(srcFile.getCanonicalPath().replace(srcCanonicalPath, dstCanonicalPath)); |
227 | 228 | if(!dstFile.exists() || dstFile.length() != srcFile.length() || dstFile.lastModified() != srcFile.lastModified()) { |
228 | - dstFile.getParentFile().mkdirs(); | |
229 | - Files.copy(srcFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES); | |
229 | + try { | |
230 | + dstFile.getParentFile().mkdirs(); | |
231 | + Files.copy(srcFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES); | |
232 | + } catch(NoSuchFileException e) { | |
233 | + //気にしない。 | |
234 | + } | |
230 | 235 | } |
231 | 236 | if(dstFile.exists() && outputFiles != null) { |
232 | 237 | outputFiles.add(dstFile.toPath()); |
@@ -8,6 +8,7 @@ | ||
8 | 8 | import java.io.Writer; |
9 | 9 | import java.nio.charset.Charset; |
10 | 10 | import java.nio.file.Files; |
11 | +import java.nio.file.NoSuchFileException; | |
11 | 12 | import java.nio.file.StandardCopyOption; |
12 | 13 | import java.util.ArrayList; |
13 | 14 | import java.util.HashMap; |
@@ -175,8 +176,12 @@ | ||
175 | 176 | for(File srcFile : list) { |
176 | 177 | File dstFile = new File(srcFile.getCanonicalPath().replace(srcCanonicalPath, dstCanonicalPath)); |
177 | 178 | if(!dstFile.exists() || dstFile.length() != srcFile.length() || dstFile.lastModified() != srcFile.lastModified()) { |
178 | - dstFile.getParentFile().mkdirs(); | |
179 | - Files.copy(srcFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES); | |
179 | + try { | |
180 | + dstFile.getParentFile().mkdirs(); | |
181 | + Files.copy(srcFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES); | |
182 | + } catch(NoSuchFileException e) { | |
183 | + //気にしない。 | |
184 | + } | |
180 | 185 | } |
181 | 186 | } |
182 | 187 | } |