Crystal Space
Welcome, Guest. Please login or register.
October 25, 2014, 01:14:57 am

Login with username, password and session length
Search:     Advanced search
9011 Posts in 2044 Topics by 8817 Members
Latest Member: Natsaw1610
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  VFS and Spaces on WinXP
« previous next »
Pages: [1] Print
Author Topic: VFS and Spaces on WinXP  (Read 2453 times)
IPKnightly
Guest


Email
« on: September 30, 2005, 06:27:05 pm »

Hi,

I was creating a CS application that plays a wav file. I wrote the program in Python. In my VFS.cfg file I had this mount:

VFS.Mount.soundtest/sounds = $^data$/sounds$/

And the file is located here:

C:\Documents and Settings\me\My Documents\cspython\soundtest\data\sounds\soundclip.wav

Here is where I load the file in CS:

w = self.loader.LoadSound( 'warn', '/soundtest/sounds/soundclip.wav' )

When I ran the file I got an error similar to this:

crystalspace.leveloader.map.sound.parser: could not open file '/soundtest/sounds/soundclip.wav' in VFS!

It wasn't until I changed the mount to this did the app work:

VFS.Mount.soundtest/sounds = C:$/Docume~1$/DavidL~1$/MyDocu~1$/cspython$/soundtest$/data$/sounds$/

You see the $^ variable carries spaces at 'Documents<space>and<space>Setting' and at 'My<space>Documents'.

I had talked to Jorrit about this and he wanted me to post in the forums.

So why can't VFS handle spaces on the WindowsXP platform?

I don't want to hard code where the files are as if I distributed my game to other computers the file paths would be void.

Thank you.
Logged
beakcon
Newbie
*
Posts: 10

beakcon@hotmail.com beakcon beakcon
View Profile Email
« Reply #1 on: September 30, 2005, 06:37:53 pm »

if you distributed you're game to to other computers wouldn't you just keep your files in archives with in the game folder and refrence them trough the vfs with your game directerory as root for the vfs.....i'm kinda really newbie...not sure if i compleatly understand how all that works but....just a curiosity...i'm only a third way through the tutorial...
Logged
IPKnightly
Guest


Email
« Reply #2 on: September 30, 2005, 06:46:14 pm »

You're correct. However as stated above the VFS variables: $* and $^ look up the application directory or resource directory. But the variables are variables and stand for something static and as such if they hold a file path with spaces then VFS breaks down. Unless spaces can be handled then each mount must be manually written out using '~1' to stand for spaces. On a side note archives or 'zip' files do not have to be used. However, if they are do not end your mounting path with a '$/'
Logged
sunshine
Administrator
Sr. Member
*****
Posts: 294


View Profile
« Reply #3 on: September 30, 2005, 06:48:32 pm »

How do you know that spaces in $^ are the problem? From your post, I don't see any evidence one way or another which would indicate that spaces are at fault. It seems more likely that the problem is that the expansion of $^ is not what you think it is, and that it is pointing at some place other than you expect.

It would be a good idea to indicate which version of CS you are using, since the handling of $^ has been improved (fixed) in the CVS version of CS for pure-Python programs. In the CVS version, $^ should point at the directory in which your master .py file resides (assuming that everything is still correctly working).

Perhaps the easiest way to find out to what $^ actually expands is to restore vfs.cfg to use $^ in that mount, and then use the 'rpath' command (if I recall correctly) within the 'vsh' tool to ask VFS for the "real path" of that VFS path. Once you know the actual expansion of $^, it should be possible figure out a solution.

By the way, for maximum portability, you should be using $* rather than $^.
Logged
IPKnightly
Guest


Email
« Reply #4 on: September 30, 2005, 10:05:33 pm »

VSH:



Still have the Error Message:

Logged
sunshine
Administrator
Sr. Member
*****
Posts: 294


View Profile
« Reply #5 on: October 01, 2005, 12:03:38 am »

Still within 'vsh', what happens if you actually try accessing the sound file. Try, for instance, to copy the file:

vsh> cp /soundtest/sounds/soundclip.wav /tmp/soundclip.wav
Logged
IPKnightly
Guest


Email
« Reply #6 on: October 01, 2005, 03:48:11 am »



It worked. So what's going on here? I still get the error message.
Logged
sunshine
Administrator
Sr. Member
*****
Posts: 294


View Profile
« Reply #7 on: October 02, 2005, 02:39:30 am »

Here's the relevant C++ code:

csPtr<iSndSysData> csLoader::LoadSoundSysData (const char* filename)
{
  csRef<iDataBuffer> buf = VFS->ReadFile (filename);
  if (!buf || !buf->GetSize ())
  {
    ReportError (...);

From Python, try interacting with iVFS directly. Invoke the ReadFile() method with your filename and check the result.

From Python, you might also want to check the result of iVFS::GetMounts(). Try passing each of the returned VFS paths to iVFS::GetRealMountPaths() and print the result.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 6.325 seconds with 15 queries.