Greetings,
the current directory structure of the game used in the C++ and
WML source code relies on maybe 3 or more different approaches
to find the path of a resource. Even further there is directory
relative path information which won't be resolved by the preprocessor
and the sources are cluttered with unnecessary decentral resource path
determination which follows different directory structure conventions.
Therefor I propose a package base path relative resource type
independent approach which would involve the following WML related
changes:
Distinguishing the userdata and data will be unnecessary and therefor
should not be supported.
The WML preprocessor resource path specification simplifies to:
- {path} for a resource relative to the global wesnoth base
- {~/path} for a resource relative to the local package base path
Herein the following restrictions to 'path' apply:
- mut not contain ".." or "./'
- must not be "."
- must not start with "/"
- must not contain whitespaces
- must not contain antything outside the 7bit ASCII range
- the resource specified by 'path' should be
locatable by prepending the appropriate base path to 'path'
The preprocessor is responsible for turning the local package base
path into a global wesnoth base path.
Filesystem entries specified relative to the global wesnoth base path
will be located using the PhysFs search path approach which requires
adding the platform dependent userdata and data directories to the
PhysFs search path during filesystem subsystem initialization of the
game.
In case you are not familiar with this implementation you should read
the documentation at:
http://icculus.org/physfs/docs-devel/html/index.html
The only writable directory will be the userdata directory and all of
its subdirectories. Add-on packages should not be allowed to write
outside of their respective add-on package local base path.
Compressed add-on packages or data directories can be added to the
search path at any time using PhysFs.
I chose to use an existing open source filebuf, ofstream and ifstream
abstraction using PhysFs for basic io in my current testing
implementation instead of writing my own because this one looks rock
solid and standard compliant:
http://svn.gna.org/viewcvs/warzone/branches/sound/lib/sound/general/physfs_stream.hpp
To be able use the search dir relative resource specifications and
mounted compressed archives with SDL there are existing RWOps here:
http://svn.icculus.org/physfs/trunk/extras/
I've got a working testing implementation of wesnoth which still needs
the RWOps to be implmented and some stuff is broken because of the
inconsient decentral path specification wesnoth uses right now.
So far I didn't do any changes to the WML preprocessor or parser.
This thread should primarily be used to discuss technical issues in
regard to wesnoth directory structure and path specifcation
simplication in WML and C++ on the assumption of adding PhysFs
support.
This thread should not be used to discuss why we should add PhysFs
or if we should add PhysFs support. If you want todo so please create
a new thread linking to this one.
Jon Daniel
_______________________________________________
Wesnoth-dev mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-dev