Sign in to follow this  
themean

PHYSFS_enumerateFiles don't work

Recommended Posts

I'm trying PhysicsFS. But can't get list of all files and directories with [url="http://icculus.org/physfs/docs/html/physfs_8h.html#a0f4ae950c2dae0735a91263ddd20fbf4"]PHYSFS_enumerateFiles[/url].

Here is my test example:



[color=#000080]#include[/color][color=#c0c0c0] [/color][color=#008000]<iostream>[/color]

[color=#000080]#include[/color][color=#008000]<physfs.h>[/color]



[color=#808000]int[/color][color=#c0c0c0] [/color]main[color=#000000]()[/color]
[color=#000000]{[/color]

[color=#c0c0c0] [/color][color=#800080]std[/color][color=#000000]::[/color]cout[color=#000000]<<[/color][color=#008000]"begin"[/color][color=#000000]<<[/color][color=#800080]std[/color][color=#000000]::[/color]endl[color=#000000];[/color]

[color=#c0c0c0] [/color]PHYSFS_init[color=#000000]([/color]NULL[color=#000000]);[/color]

[color=#c0c0c0] [/color][color=#808000]if[/color][color=#000000]([/color]PHYSFS_mount[color=#000000]([/color][color=#008000]"myzip.zip"[/color][color=#000000],[/color][color=#000080]0[/color][color=#000000],[/color][color=#000080]1[/color][color=#000000]))[/color]
[color=#c0c0c0] [/color][color=#000000]{[/color]
[color=#c0c0c0] [/color][color=#808000]char[/color][color=#c0c0c0] [/color][color=#000000]**[/color][color=#000000]rc[/color][color=#c0c0c0] [/color][color=#000000]=[/color][color=#c0c0c0] [/color]PHYSFS_enumerateFiles[color=#000000]([/color][color=#008000]"folder"[/color][color=#000000]);[/color]
[color=#c0c0c0] [/color][color=#808000]char[/color][color=#c0c0c0] [/color][color=#000000]**[/color][color=#000000]i[/color][color=#000000];[/color]

[color=#c0c0c0] [/color][color=#808000]if[/color][color=#000000](!*[/color][color=#000000]rc[/color][color=#000000])[/color]
[color=#c0c0c0] [/color][color=#000000]{[/color]
[color=#c0c0c0] [/color][color=#800080]std[/color][color=#000000]::[/color]cout[color=#000000]<<[/color][color=#008000]"Can't[/color][color=#c0c0c0] [/color][color=#008000]print[/color][color=#c0c0c0] [/color][color=#008000]file[/color][color=#c0c0c0] [/color][color=#008000]list"[/color][color=#000000]<<[/color][color=#800080]std[/color][color=#000000]::[/color]endl[color=#000000];[/color]
[color=#c0c0c0] [/color][color=#800080]std[/color][color=#000000]::[/color]cout[color=#000000]<<[/color]PHYSFS_getLastError[color=#000000]()<<[/color][color=#800080]std[/color][color=#000000]::[/color]endl[color=#000000];[/color]
[color=#c0c0c0] [/color][color=#000000]}[/color]
[color=#c0c0c0] [/color][color=#808000]for[/color][color=#c0c0c0] [/color][color=#000000]([/color][color=#000000]i[/color][color=#c0c0c0] [/color][color=#000000]=[/color][color=#c0c0c0] [/color][color=#000000]rc[/color][color=#000000];[/color][color=#c0c0c0] [/color][color=#000000]*[/color][color=#000000]i[/color][color=#c0c0c0] [/color][color=#000000]!=[/color][color=#c0c0c0] [/color]NULL[color=#000000];[/color][color=#c0c0c0] [/color][color=#000000]i[/color][color=#000000]++)[/color]
[color=#c0c0c0] [/color][color=#000000]{[/color]

[color=#c0c0c0] [/color][color=#800080]std[/color][color=#000000]::[/color]cout[color=#000000]<<[/color][color=#008000]"We've[/color][color=#c0c0c0] [/color][color=#008000]got"[/color][color=#000000]<<*[/color][color=#000000]i[/color][color=#000000]<<[/color][color=#800080]std[/color][color=#000000]::[/color]endl[color=#000000];[/color]
[color=#c0c0c0] [/color][color=#000000]}[/color]

[color=#c0c0c0] [/color]PHYSFS_freeList[color=#000000]([/color][color=#000000]rc[/color][color=#000000]);[/color]
[color=#c0c0c0] [/color][color=#000000]}[/color]

[color=#c0c0c0] [/color][color=#808000]else[/color]
[color=#c0c0c0] [/color][color=#000000]{[/color]
[color=#c0c0c0] [/color][color=#800080]std[/color][color=#000000]::[/color]cout[color=#000000]<<[/color][color=#008000]"Can't[/color][color=#c0c0c0] [/color][color=#008000]add[/color][color=#c0c0c0] [/color][color=#008000]search[/color][color=#c0c0c0] [/color][color=#008000]path"[/color][color=#000000]<<[/color][color=#800080]std[/color][color=#000000]::[/color]endl[color=#000000];[/color]
[color=#c0c0c0] [/color][color=#800080]std[/color][color=#000000]::[/color]cout[color=#000000]<<[/color]PHYSFS_getLastError[color=#000000]()<<[/color][color=#800080]std[/color][color=#000000]::[/color]endl[color=#000000];[/color]
[color=#c0c0c0] [/color][color=#000000]}[/color]

[color=#c0c0c0] [/color][color=#800080]std[/color][color=#000000]::[/color]cout[color=#000000]<<[/color][color=#008000]"end"[/color][color=#000000]<<[/color][color=#800080]std[/color][color=#000000]::[/color]endl[color=#000000];[/color]

[color=#c0c0c0] [/color]PHYSFS_deinit[color=#000000]();[/color]
[color=#c0c0c0] [/color][color=#808000]return[/color][color=#c0c0c0] [/color][color=#000080]0[/color][color=#000000];[/color]
[color=#000000]}[/color]






[size=3][font=arial,helvetica,sans-serif][color=#000000]"myzip.zip" is archive of "myzip" folder that contain sub folder "folder"[/color]
[color=#000000]My application output is:[/color][/font][/size]


[size=3][font=arial,helvetica,sans-serif][color=#000000]begin[/color][/font][/size]
Can't print file list
File not found
end

My operation system is debian squeeze Edited by themean

Share this post


Link to post
Share on other sites
I solve the problem.I must give root directory to PHYSFS_enumerateFiles or relative path to root.
For example i must give myzip/folder to PHYSFS_enumerateFiles.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this