diff --git a/src/floppy/disk.ts b/src/floppy/disk.ts
index 806af76..d085e78 100644
--- a/src/floppy/disk.ts
+++ b/src/floppy/disk.ts
@@ -42,6 +42,7 @@ export interface IAttributes {
export interface IStandardDirEntry {
type: 'standard-entry'
name: string
+ basename: string
extension: string
attributes: IAttributes
size: number
@@ -197,16 +198,14 @@ export class FloppyDisk {
continue
}
- const fullName = `${entry.name}${entry.extension ? '.' + entry.extension : ''}`
-
if (entry.name === '.' || entry.name === '..' || entry.attributes.volumeId) {
// do nothing
} else if (entry.attributes.directory) {
- listing += `\n
${fullName}\\`
+ listing += `\n${entry.name}\\`
listing = this.addDirectory(listing, entry.subDirEntries)
listing += '\n'
} else {
- listing += `\n${fullName}\n`
+ listing += `\n${entry.name}\n`
}
}
@@ -314,11 +313,15 @@ function decodeDirectoryEntry(data: DataView, fd: FloppyDisk): TDirEntry | null
return { type: 'long-filename-entry' }
} else {
const asciiDecoder = new TextDecoder('ascii')
- const name = asciiDecoder.decode(data.buffer.slice(data.byteOffset, data.byteOffset + 8)).trim()
+ const basename = asciiDecoder
+ .decode(data.buffer.slice(data.byteOffset, data.byteOffset + 8))
+ .trim()
const extension = asciiDecoder
.decode(data.buffer.slice(data.byteOffset + 8, data.byteOffset + 11))
.trim()
+ const name = basename + (extension ? '.' + extension : '')
+
const attributeByte = data.getUint8(11)
const attributes: IAttributes = {
@@ -336,6 +339,7 @@ function decodeDirectoryEntry(data: DataView, fd: FloppyDisk): TDirEntry | null
const entry: IStandardDirEntry = {
type: 'standard-entry',
name,
+ basename,
extension,
attributes,
firstCluster,