diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 0473bd5e..c446c42b 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -52,7 +52,7 @@ Project Page: https://github.com/a2stuff/a2d * Click on menu bar clock now shows Date & Time DA. * Refresh correct window after renaming an icon, if view is by name. * Fix corruption when exiting Shortcuts dialogs with a list view window. (([#790](https://github.com/a2stuff/a2d/issues/790)) - +* Clear GS/OS "case bits" when renaming files/volumes. (([#352](https://github.com/a2stuff/a2d/issues/352)) ### Selector diff --git a/desktop/main.s b/desktop/main.s index 11f0b178..a6bf2a78 100644 --- a/desktop/main.s +++ b/desktop/main.s @@ -12001,22 +12001,15 @@ Start: lda DEVNUM dst_ptr := $08 ;; Point `src_ptr` / `dst_ptr` at `FileEntry` structures - copy16 #src_block + 4, src_ptr - copy16 #dst_block + 4, dst_ptr + ldax #src_block + ldy src_entry_num + jsr GetFileEntryBlockOffset + stax src_ptr - ldx src_entry_num - IF_NOT_ZERO -: add16_8 src_ptr, #.sizeof(FileEntry) - dex - bne :- - END_IF - - ldx dst_entry_num - IF_NOT_ZERO -: add16_8 dst_ptr, #.sizeof(FileEntry) - dex - bne :- - END_IF + ldax #dst_block + ldy dst_entry_num + jsr GetFileEntryBlockOffset + stax dst_ptr ;; Swap everything but `header_pointer` ldy #FileEntry::header_pointer-1 @@ -13015,6 +13008,11 @@ ShowErrorAlertDst := ShowErrorAlertImpl::flag_set .proc ApplyCaseBits jsr GetSrcFileInfo bcs fallback + copy DEVNUM, unit_number + + lda src_file_info_params::storage_type + cmp #ST_VOLUME_DIRECTORY + beq volume lda src_file_info_params::file_type cmp #FT_ADB @@ -13024,7 +13022,26 @@ ShowErrorAlertDst := ShowErrorAlertImpl::flag_set cmp #FT_ASP beq appleworks - ;; TODO: Handle GS/OS case bits + ;; -------------------------------------------------- + ;; Wipe file GS/OS case bits + + ldax #src_path_buf + jsr GetFileEntryBlock + bcs fallback + stax block_number + + block_ptr := $06 + ldax #block_buffer + jsr GetFileEntryBlockOffset ; Y is already the entry number + stax block_ptr + + MLI_CALL READ_BLOCK, block_params + bcs fallback + ldy #FileEntry::version + copy16in #0, (block_ptr),y +write_block: + MLI_CALL WRITE_BLOCK, block_params + FALL_THROUGH_TO fallback ;; -------------------------------------------------- fallback: @@ -13055,6 +13072,21 @@ appleworks: bpl :- jmp SetSrcFileInfo + + ;; -------------------------------------------------- + ;; Wipe volume GS/OS case bits +volume: + copy16 #2, block_number ; volume directory key block + MLI_CALL READ_BLOCK, block_params + bcs fallback + copy16 #0, block_buffer + $1A + jmp write_block + + block_buffer := $800 + DEFINE_READ_BLOCK_PARAMS block_params, block_buffer, SELF_MODIFIED + unit_number := block_params::unit_num + block_number := block_params::block_num + .endproc ; ApplyCaseBits ;;; ============================================================ @@ -14256,6 +14288,36 @@ exit: .endproc ; GetFileEntryBlock +;;; ============================================================ +;;; After calling `GetFileEntryBlock`, this can be used to translate +;;; the entry number in Y into the address of the corresponding +;;; `FileEntry` with a memory buffer for the block. + +;;; Inputs: A,X = directory block, Y = entry number in block +;;; Outputs: A,X = pointer to `FileEntry` + +.proc GetFileEntryBlockOffset + ;; Skip prev/next block pointers + clc + adc #4 + bcc :+ + inx +: + ;; Iterate through entries + cpy #0 + beq ret + +loop: clc + adc #.sizeof(FileEntry) + bcc :+ + inx +: dey + bne loop + +ret: rts + +.endproc ; GetFileEntryBlockOffset + ;;; ============================================================ ;;; ;;; Routines beyond this point are used by overlays diff --git a/res/notes/testplan.md b/res/notes/testplan.md index bd1a8756..b7159ecc 100644 --- a/res/notes/testplan.md +++ b/res/notes/testplan.md @@ -52,6 +52,9 @@ * Launch DeskTop. Select an AppleWorks file icon. File > Rename..., and specify a name using a mix of uppercase and lowercase. Click OK. Close the containing window and re-open it. Verify that the filename case is retained. * Launch DeskTop. Select an AppleWorks file icon. File > Duplicate..., and specify a name using a mix of uppercase and lowercase. Click OK. Close the containing window and re-open it. Verify that the filename case is retained. +* Launch DeskTop. Select a file named with mixed case using GS/OS (e.g. ProDOS 2.5 disk). File > Rename..., and specify a new name. Click OK. Verify that the name reverts to heuristic mixed-case. Close the containing window and re-open it. Verify that the heuristic mixed-case name remains. +* Launch DeskTop. Select a volume named with mixed case using GS/OS (e.g. ProDOS 2.5 disk). File > Rename..., and specify a new name. Click OK. Verify that the name reverts to heuristic mixed-case. Restart DeskTop. Verify that the heuristic mixed-case name remains. + * File > Get Info a non-folder file. Verify that the size shows as "_size_K". * File > Get Info a folder containing 0 files. Verify that the size shows as "_size_K for 1 item". * File > Get Info a folder containing 1 files. Verify that the size shows as "_size_K for 2 items".