Code archives/File Utilities/Shortcut Finder

This code has been declared by its author to be Public Domain code.

Download source code

Shortcut Finder by Cygnus
(Posted 21 years ago)
This code was written because I got fed up of GTA needing you to copy all your MP3s actually into the audio folder-

What it does is find the corresponding file to a shortcut, so you can then load the real file...
This means you can have a folder full of shortcuts and still access the files from elsewhere.

VERY usefull for user audio.


Dont want to use it for MP3? Change the EXT$ variable! :D


Also note that this is pretty much a "kludge". its never failed me so far though!
Function getshortcut$(file$)
Local EXT$=".MP3"
Local ret$,ft,ln$,lnv,ok,ook,filename$,fl,lnb
FT=FileType(file$)
If FT=1 Then
	FL=ReadFile(File$)
	Repeat
		LNb=ReadByte(FL)
		ln$=ln$+Chr$(lnb)
	Until Eof(fl)
	LNV=Len(LN$)-1
	Repeat:OK=0
		LNV=LNV-1:If LNV<1 Then LNV=1:OK=2
		If Mid$(LN$,LNV,1)=":" And Mid$(LN$,LNV+1,1)="\" Then
			ook=ok:ok=1:filename$=Mid$(LN$,LNV-1)
			eol=Instr(Upper$(filename$),ext$):If eol>0 Then filename$=Mid$(filename$,1,eol+3)
			If FileType(filename$)<>1 Then ok=ook
		EndIf
	Until OK<>0
EndIf
If FileType(filename$)=1 Then ret$=filename$
Return ret$
End Function