[igrnoe this]an idea about file handling on Linux(case and/)

Everything about development and the OpenMW source code.
Post Reply
User avatar
natirips
Posts: 52
Joined: 26 Apr 2012, 10:48
Location: Solar System/~Zagreb
Contact:

[igrnoe this]an idea about file handling on Linux(case and/)

Post by natirips »

I've noticed how "Sort out the remaining path problems on Linux (case and "/" "" problems for resources files) " is under suggested_tasks in the wiki and I had an idea this morning.

Btw, sorry that I'm not on good terms with C++. I use only C.

Anyway, if you were to

Code: Select all

popen("find /path/to/Morrowind/Data\ Files","r");
you will get the full list of all files in all sub-directories of Data Files. Read each line into a string, and assign another (lowercase or uppercase) string to it that resembles the Windows-equivalent filename.

You can even popen("find ...","r") it through multiple directories and append/overwrite files to the list. This way you could easily implement support for keeping mods/saves in user's home folder in Linux.

You would, however, need to implement a way of getting a list of all the files in a .bsa archive.

IMO best use something along these lines:

Code: Select all

enum filetype{
  bsa, datafile, save, whatever
};
struct filename{
  char *physical, *logical;
  enum filetype type;
  uint64 offset;
};
Here physical would be "./Music/Special/MW_Triumph.mp3", logical would be "./music/special/mw_triumph.mp3" and type would be datafile.

Another example would be: physical="./Morrowind.bsa/Meshes/whatEVER", logical="./meshes/whatever", type=bsa, offset=12345.

I'm not sure how .bsa works exactly, but I hope you the idea.
Last edited by natirips on 26 Apr 2012, 12:13, edited 1 time in total.
User avatar
psi29a
Posts: 5362
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: an idea about file handling on Linux (case and /)

Post by psi29a »

Boost should handle all filename handling regardless of platform, if I'm not mistaken.

I've not encountered any path problems in Linux.

The wiki is also outdated in terms of 'tasks', it is probably better to have a look at the bug tracker:
http://bugs.openmw.org/projects/openmw/roadmap
User avatar
natirips
Posts: 52
Joined: 26 Apr 2012, 10:48
Location: Solar System/~Zagreb
Contact:

Re: [igrnoe this]an idea about file handling on Linux(case a

Post by natirips »

Ah, sorry to the bothered any readers then.
User avatar
psi29a
Posts: 5362
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: [igrnoe this]an idea about file handling on Linux(case a

Post by psi29a »

natirips wrote:Ah, sorry to the bothered any readers then.
Not at all! Thanks for the input.

Zini, can we get a confirmation? :)
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: [igrnoe this]an idea about file handling on Linux(case a

Post by Zini »

This problem has been addressed a long time ago. The wiki pages linked from the Older Documentation page and most of the orphaned pages are hopelessly outdated (beyond the point where updating them still would make sense). If someone with wiki skills has time for it, these pages should be marked with a banner-type "This page is outdated" template.
Post Reply