Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#137 closed bug (fixed (in master))

File handling cleanup

Reported by: takkaria Owned by: elly
Milestone: 3.1.0 Keywords: cleanup
Cc:

Description (last modified by takkaria)

Main priority here is to design a single API for file access, and behind it write the code for specific systems.

Other thoughts:

  • init font/graf/sound directories globally at the beginning
  • allocate all pathnames dynamically (no buffer-too-short problems)
  • all pathnames should always be stored system-specific and absolute (and so only one place needs filename translation)

Also see #137, for platform-independent directory creating code.

Attachments (2)

rough.patch (113.8 KB) - added by takkaria 10 years ago.
This compiles and works on Linux (at least). Contains unit tests.
works-on-win-no-tests.diff (110.5 KB) - added by takkaria 10 years ago.
Got it working on Win XP

Download all attachments as: .zip

Change History (13)

comment:1 Changed 11 years ago by takkaria

  • Keywords cleanup added

comment:2 Changed 10 years ago by takkaria

  • Description modified (diff)
  • Summary changed from Audit file handling code to File handling cleanup

comment:3 Changed 10 years ago by takkaria

  • Owner set to elly

comment:4 Changed 10 years ago by takkaria

API available, though it's changed a little bit while implementing.

Will take a while to filter into the game, just because it's taking a while to rename everything to use the new functions.

comment:5 Changed 10 years ago by takkaria

  • Description modified (diff)

comment:6 Changed 10 years ago by takkaria

It's getting close.

Changed 10 years ago by takkaria

This compiles and works on Linux (at least). Contains unit tests.

comment:7 Changed 10 years ago by takkaria

With aforementioned patch:

  • RISC OS is broken for sure
  • Macs might be a little broken
  • Windows should be OK but is untested

A umask() call needs adding for Unix platforms with bad defaults. OS X needs a converter between Angband filetypes and OS X filetypes.

Note that the unit tests aren't *quite* 100% coverage, but they're pretty close. Main omission is anything for the "append" mode.

Changed 10 years ago by takkaria

Got it working on Win XP

comment:8 Changed 10 years ago by takkaria

That patch functions on Windows (properly!) but untested on anything else. Other issues still apply.

comment:9 Changed 10 years ago by takkaria

[f07fa18] (SVN r469) and [0ad7016] (SVN r470) contain the file API changes. Initing font/graf/sound directories globally at the beginning would still be nice, but not sure the gain is worth it.

Documentation to follow in header file.

comment:10 Changed 10 years ago by takkaria

  • Resolution set to fixed
  • Status changed from new to closed

Documented in [1cea3ed] (SVN r474). Closing as fixed; this cleanup is "done". Please file new bugs for fallout on e.g. OS X.

comment:11 Changed 10 years ago by takkaria

  • Milestone changed from 3.2.0 to 3.1.0
Note: See TracTickets for help on using tickets.