[bb] Shortcut Finder by Damien Sturdy [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:43

Previous topic - Next topic

BlitzBot

Title : Shortcut Finder
Author : Damien Sturdy
Posted : 1+ years ago

Description : 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!


Code :
Code (blitzbasic) Select
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


Comments :


jfk EO-11110(Posted 1+ years ago)

 Very useful, thanks!