comparison src/org/tmatesoft/hg/internal/FNCacheFile.java @ 647:c75297c17867

Location of repository files as enumeration, use file constants instead of plain names
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 25 Jun 2013 18:53:18 +0200
parents 507602cb4fb3
children 46b56864b483
comparison
equal deleted inserted replaced
646:3b7d51ed4c65 647:c75297c17867
13 * For information on how to redistribute this software under 13 * For information on how to redistribute this software under
14 * the terms of a license other than GNU General Public License 14 * the terms of a license other than GNU General Public License
15 * contact TMate Software at support@hg4j.com 15 * contact TMate Software at support@hg4j.com
16 */ 16 */
17 package org.tmatesoft.hg.internal; 17 package org.tmatesoft.hg.internal;
18
19 import static org.tmatesoft.hg.repo.HgRepositoryFiles.FNCache;
18 20
19 import java.io.File; 21 import java.io.File;
20 import java.io.FileOutputStream; 22 import java.io.FileOutputStream;
21 import java.io.IOException; 23 import java.io.IOException;
22 import java.nio.ByteBuffer; 24 import java.nio.ByteBuffer;
76 78
77 public void write() throws IOException { 79 public void write() throws IOException {
78 if (addedDotI.isEmpty() && addedDotD.isEmpty()) { 80 if (addedDotI.isEmpty() && addedDotD.isEmpty()) {
79 return; 81 return;
80 } 82 }
81 File f = fncacheFile(); 83 File f = repo.getRepositoryFile(FNCache);
82 f.getParentFile().mkdirs(); 84 f.getParentFile().mkdirs();
83 final Charset filenameEncoding = repo.getFilenameEncoding(); 85 final Charset filenameEncoding = repo.getFilenameEncoding();
84 ArrayList<CharBuffer> added = new ArrayList<CharBuffer>(); 86 ArrayList<CharBuffer> added = new ArrayList<CharBuffer>();
85 for (Path p : addedDotI) { 87 for (Path p : addedDotI) {
86 added.add(CharBuffer.wrap(pathHelper.rewrite(p))); 88 added.add(CharBuffer.wrap(pathHelper.rewrite(p)));
110 } 112 }
111 113
112 public void addData(Path p) { 114 public void addData(Path p) {
113 addedDotD.add(p); 115 addedDotD.add(p);
114 } 116 }
115
116 private File fncacheFile() {
117 return repo.getFileFromStoreDir("fncache");
118 }
119 } 117 }