Relative path

BlitzMax Forums/BlitzMax Programming/Relative path

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

write a function that compares the two strings from the start to the end. When they don't match anymore build the correct relative path and return it. Use the string methods to look for / and \, somthing like this

Local index:Int = filename.FindLast("/")
Local path:String = ""
If index=-1 Then index = filename.FindLast("\")
If index<>-1 Then path=filename[..index]