Sign in to follow this  

PHYSFS_enumerateFiles don't work

This topic is 2026 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this