EnsureDirectoryExists() does only work with a path deepth of 1.

Bug #993293 reported by Nasenbaer on 2012-05-02
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

The EnsureDirectoryExists() function is used at some places in Widelands, where dynamic access to user generated data is managed.

But EnsureDirectoryExists does currently only work with a path deepth of 1, if subdirectory of a not yet existing directory is requested, it fails.

This leads to problems, if e.g. a new player (clean install, no data in ~/.widelands) joins an online game with a self created/downloaded map saved in a subdirectory of the ~/.widelands/maps directory.

> XYZ has left the game (Something went wrong: [c:/data/repo/trunk/src/io/filesystem/disk_filesystem.cc:329] RealFSImpl::EnsureDirectoryExists(maps\Nasenbaer): RealFSImpl::MakeDirectory: No such file or directory: maps\Nasenbaer)

It seems like a good idea, to fix EnsureDirectoryExist() to make it work with a bigger path deepth.

Borim (borim) on 2012-05-03
Changed in widelands:
assignee: nobody → Borim (borim)
status: Confirmed → In Progress
Borim (borim) wrote :

I have a problem to trigger this bug. Is the bug already fixed?

I wrote a little testprogramm, so I can verify the function faster. The program is attached.
With this test program I can create directories of any depth (e.g.: dirtest/sub/sub2). The whole path does not exists before the test is run and afterwards the complete path exists.

Nasenbaer (nasenbaer) wrote :

You are right. I just saw the error in the logs of my dedicated server and did not check it myself.
It indeed works on linux. However on Windows machines, it does not work.

Talking about Windows, I guess the problem is in http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/io/filesystem/disk_filesystem.cc#L312

instead of the "/" there should be m_root (at least I think that's the constant that holds either \\ for windows or / for unix systems.)

Borim (borim) wrote :

I do not have a working build system for windows, so someone else take a look.

Changed in widelands:
assignee: Borim (borim) → nobody
status: In Progress → Confirmed
Nasenbaer (nasenbaer) wrote :

I committed the patch in rev. 6382. I had no buildsystem for validation before submission either, but as noone shuted up here and the problem seemed pretty clear, I fixed the described code error and committed it together with one more bug I found to trunk.

Let's see whether someone reopens this bug :).

Changed in widelands:
status: Confirmed → Fix Committed
SirVer (sirver) wrote :

Released in build-18 rc1.

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers