Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Visitor
Posts: 1
Registered: ‎07-26-2013
My Device: BB10 Developer (Z10/Q10...)

Best approach to replace absolute path with displayed path e.g. /account/1000/shared/documents with Device/documents

 

The  application uses bb::cascades:Smiley Tongueickers::FilePicker to allow the user to browse the file system to choose a file which then, for example, is used for importing information to the application.

 

For confirmation purposes the application displays the chosen file (path) to the user.

 

However, the returned file path is absolute e.g. /accounts/1000/shared/documents/file.txt which for an uninformed user is different to the experience in the FilePicker of "Device/documents/file.txt".

 

I'd prefer to use a system API or macro rather than simply do the replacement myself. I've searched but cannot find a defined programmatic way of retrieving or converting the returned absolute path and the displayed path in FilePicker.

 

Has anyone come across this?

 

 

Developer
Posts: 271
Registered: ‎05-29-2013
My Device: BlackBerry Z10
My Carrier: MTS

Re: Best approach to replace absolute path with displayed path e.g. /account/1000/shared/documents with Device/documents

It seems there is no such API. You should convert it manually.
-------------------------------------------------------------------------------
NSR Reader for BlackBerry 10 @NSRReader on Twitter
Me @xelfium on Twitter
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Best approach to replace absolute path with displayed path e.g. /account/1000/shared/documents with Device/documents

i did that without much hassle:
if (selctedPath.indexOf("file://") == -1){
selctedPath = "file://"+selctedPath;
}
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter