~1 paths

BlitzMax Forums/BlitzMax Programming/~1 paths

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.

Here's what I have so far.. but it doesn't work.

DebugLog GetFullPath(getenv_("temp"))

Function GetFullPath:String(shortpath:String)
  Local lngpath:Byte Ptr, size:Int = Len(shortpath)
	
	GetLongPathNameW(shortpath, lngpath, 1024)
	
  Return String.fromcstring(lngpath)

End Function


Extern "win32"

	Function GetLongPathNameW(lpzshortpath:String, lpzlongpath:Byte Ptr, cchbuff:Int) = "GetLongPathNameW@12"
	
End Extern


EDIT: found this code by leadwerks (for b+)
Function NiceFileName$(file$)
	size = Len(file) + 100
	temp = CreateBank(size)
	GetShortPathName(file$, temp, size)
	file$ = PeekString(temp, 0)
	GetLongPathName(file$, temp, size)
	s$ = PeekString(temp, 0)
	FreeBank temp
	
	Return s
	
End Function


I am fairly certain there is a way in max to do it without using a bank, it just hasn't come to me yet :/