|
19 | 19 | */ |
20 | 20 | package io.github.applecommander.acx.command; |
21 | 21 |
|
22 | | -import java.io.ByteArrayInputStream; |
23 | | -import java.io.ByteArrayOutputStream; |
24 | | -import java.io.File; |
25 | | -import java.io.IOException; |
26 | | -import java.io.InputStream; |
27 | | -import java.io.UncheckedIOException; |
28 | | -import java.nio.file.Files; |
29 | | -import java.nio.file.Path; |
30 | | -import java.util.*; |
31 | | -import java.util.function.Function; |
32 | | -import java.util.logging.Logger; |
33 | | - |
34 | 22 | import com.webcodepro.applecommander.storage.DirectoryEntry; |
35 | 23 | import com.webcodepro.applecommander.storage.FileEntry; |
36 | 24 | import com.webcodepro.applecommander.storage.os.prodos.ProdosFormatDisk; |
|
42 | 30 | import com.webcodepro.shrinkit.HeaderBlock; |
43 | 31 | import com.webcodepro.shrinkit.NuFileArchive; |
44 | 32 | import com.webcodepro.shrinkit.ThreadRecord; |
45 | | - |
46 | 33 | import io.github.applecommander.acx.base.ReadWriteDiskCommandOptions; |
47 | 34 | import io.github.applecommander.acx.converter.IntegerTypeConverter; |
48 | 35 | import io.github.applecommander.acx.fileutil.FileUtils; |
|
60 | 47 | import picocli.CommandLine.Option; |
61 | 48 | import picocli.CommandLine.Parameters; |
62 | 49 |
|
| 50 | +import java.io.*; |
| 51 | +import java.nio.file.Files; |
| 52 | +import java.nio.file.Path; |
| 53 | +import java.util.*; |
| 54 | +import java.util.function.Function; |
| 55 | +import java.util.logging.Logger; |
| 56 | + |
63 | 57 | @Command(name = "import", description = "Import file onto disk.", |
64 | 58 | aliases = { "put" }) |
65 | 59 | public class ImportCommand extends ReadWriteDiskCommandOptions { |
@@ -116,7 +110,7 @@ public int handleCommand() throws Exception { |
116 | 110 | new IOException(String.format("Directory '%s' not found.", dir))); |
117 | 111 | } |
118 | 112 | } |
119 | | - |
| 113 | + |
120 | 114 | FileUtils copier = new FileUtils(overwriteFlag); |
121 | 115 | FileEntryReader inputReader = inputData.get(); |
122 | 116 | for (FileEntryReader processorReader : processor.apply(inputReader)) { |
@@ -161,7 +155,7 @@ public void fromFile(final String filename) { |
161 | 155 | byte[] data = Files.readAllBytes(path); |
162 | 156 | fileEntryReader = OverrideFileEntryReader.builder() |
163 | 157 | .fileData(data) |
164 | | - .filename(filename) |
| 158 | + .filename(path.getFileName().toString()) |
165 | 159 | .prodosFiletype("BIN") |
166 | 160 | .build(); |
167 | 161 | } catch (IOException e) { |
@@ -365,7 +359,7 @@ private List<FileEntryReader> handleShrinkitMode(FileEntryReader reader) { |
365 | 359 | } |
366 | 360 |
|
367 | 361 | public static class Overrides { |
368 | | - @Option(names = { "-t", "--type" }, description = "ProDOS File type. " |
| 362 | + @Option(names = { "-t", "--type" }, description = "ProDOS or native file type. " |
369 | 363 | + "(Each filesystem translates between it's native types and ProDOS.)") |
370 | 364 | private Optional<String> fileType; |
371 | 365 |
|
|
0 commit comments