Problem with loading the resources 's "path"

Mac OSX specific forum
User avatar
LESTROSO
Enthusiast
Enthusiast
Posts: 124
Joined: Thu Nov 03, 2005 12:30 pm
Location: Italy
Contact:

Problem with loading the resources 's "path"

Post by LESTROSO »

LoadMovie(14,"./DATASOUND/campane.mp3")
Playmovie(14,0)

This is my example code....of my game tic tac toe but this don't work, if i try with an absolute path...i hear the sound, is ok, but with a path with subfolder don't work.....why??
Fred
Administrator
Administrator
Posts: 18220
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

You can create a bundle (by adding .app at the end of the created executable) and then put all your stuffs in the resources/ directory, it should work.
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

It works with subfolders also inside the bundle.
What is './' ??
Regads
SEO
User avatar
LESTROSO
Enthusiast
Enthusiast
Posts: 124
Joined: Thu Nov 03, 2005 12:30 pm
Location: Italy
Contact:

Post by LESTROSO »

:D Thanks Fred I'll try and then i'll confirm your teory.....Thank so Much.....


Hy Seo, "./" indicate the root of my sources that are the same of my app.

For example if i have my app on the desktop and a folder which contain my resources(sounds,images) also on the desktop i will write:

LoadMovie(15,"./DATASOUND/boink.mp3")



Ah Seo,......I Saw your site is beatuful, but i cannot downloaded your pb example, or better i have download but in the zip file were nothing.......
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

Ah Seo,......I Saw your site is beatuful, but i cannot downloaded your pb example, or better i have download but in the zip file were nothing.......
I just checked the files and all 3 example files is OK...
And the Toolbar example also shows how to use the Mac OS X bundle
with sub folders inside the bundle .... (and how you work with your project before compiling)
User avatar
LESTROSO
Enthusiast
Enthusiast
Posts: 124
Joined: Thu Nov 03, 2005 12:30 pm
Location: Italy
Contact:

Post by LESTROSO »

thanks seo i saw your file example toolbar, but i don't understand how you put the resources path...i saw this line:

TBico_1 = LoadImage(#PB_Any,#ResourceFolder + "img/tbico1.png")

but you have to declare the path in "#resourcefolder".......


but i have tryed the purebasic keyboard purebasic example:

If LoadSprite(0, "data/Player_1.bmp", 0) = 0
CloseScreen()
MessageRequester("PureBasic", "Can't load the sprite file (data/Player_1.bmp)", 0)
End
EndIf

but the program says : Can't load the sprite file (data/Player_1.bmp)

Why??? The code is right....but for me the compiler not.....Try you the keyboard example....has an astrosheep for image and then post me....thanks..a lot to all..
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

Code: Select all

; FILE HANDLE CHANGES DEPENDING ON RUNNING IDE OR BUNDLE
Line 1: ;#ResourceFolder = "Resources/"
Line 2: ;#ResourceFolder = "/Users/sveneolsson/Desktop/ToolbarOSX/Contents/Resources/"
If you Compile your app, you have an inbuilt FilePointer to the 'Contents' folder. So if you use Line 1 when you compile and make an bundle, you could have your sound and images in the Resources folder ...

When you create and test your app in the IDE you have to use Line 2, an absolute path...

So depending on if you are working on your app in the IDE or creating and compile an bundle, just simply change the value of #Resourses

((
Create the folder like I do and put your stuff like I do in the Example, then it is easy to only copy the Resource folder after you compiled the application..
))
User avatar
LESTROSO
Enthusiast
Enthusiast
Posts: 124
Joined: Thu Nov 03, 2005 12:30 pm
Location: Italy
Contact:

Post by LESTROSO »

:D MANY THANKS SEO!!!!!:D


:D Now i've understood the system.....and now work nice that you told me!!! :D


But if you did't show me how i'll became old....ahahah...

if i want load my resources to an external folder, how i can???

Seo could you also help with the delay problem please...i don't know how resolve that.........

best regards... :wink:
Post Reply