use of uk.me.parabola.imgfmt.FileNotWritableException in project mkgmap by openstreetmap.
the class FileCopier method init.
public void init(CommandArgs args) {
areaName = args.get("area-name", null);
mapsetName = args.get("mapset-name", "OSM map set");
overallDescription = args.getDescription();
outputDir = args.getOutputDir();
hideGmapsuppOnPC = args.get("hide-gmapsupp-on-pc", false);
productVersion = args.get("product-version", 100);
mdrConfig = new MdrConfig();
mdrConfig.setIndexOptions(args);
try {
imgFs = createGmapsupp();
} catch (FileNotWritableException e) {
throw new MapFailedException("Could not create gmapsupp.img file");
}
}
use of uk.me.parabola.imgfmt.FileNotWritableException in project mkgmap by openstreetmap.
the class ImgFS method createInitFS.
/**
* Set up and ImgFS that has just been created.
*
* @param chan The real underlying file to write to.
* @param params The file system parameters.
* @throws FileNotWritableException If the file cannot be written for any
* reason.
*/
private void createInitFS(FileChannel chan, FileSystemParam params) throws FileNotWritableException {
readOnly = false;
this.fsparam = params;
// The block manager allocates blocks for files.
headerBlockManager = new BlockManager(params.getBlockSize(), 0);
headerBlockManager.setMaxBlock(params.getReservedDirectoryBlocks());
// it already existing, so it is created by hand.
try {
directory = new Directory(headerBlockManager);
Dirent ent = directory.create(DIRECTORY_FILE_NAME, headerBlockManager);
ent.setSpecial(true);
ent.setInitialized(true);
FileNode f = new FileNode(chan, ent, "w");
directory.setFile(f);
header = new ImgHeader(f);
header.createHeader(params);
} catch (FileExistsException e) {
throw new FileNotWritableException("Could not create img file directory", e);
}
fileBlockManager = new BlockManager(params.getBlockSize(), params.getReservedDirectoryBlocks());
assert header != null;
}
Aggregations