October 28, 2020, 05:37:27 AM

Author Topic: [bb] Shortcut Finder by Damien Sturdy [ 1+ years ago ]  (Read 1133 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Shortcut Finder by Damien Sturdy [ 1+ years ago ]
« on: June 29, 2017, 12:28:43 AM »
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
  1. Function getshortcut$(file$)
  2. Local EXT$=".MP3"
  3. Local ret$,ft,ln$,lnv,ok,ook,filename$,fl,lnb
  4. FT=FileType(file$)
  5. If FT=1 Then
  6.         FL=ReadFile(File$)
  7.         Repeat
  8.                 LNb=ReadByte(FL)
  9.                 ln$=ln$+Chr$(lnb)
  10.         Until Eof(fl)
  11.         LNV=Len(LN$)-1
  12.         Repeat:OK=0
  13.                 LNV=LNV-1:If LNV<1 Then LNV=1:OK=2
  14.                 If Mid$(LN$,LNV,1)=":" And Mid$(LN$,LNV+1,1)="" Then
  15.                         ook=ok:ok=1:filename$=Mid$(LN$,LNV-1)
  16.                         eol=Instr(Upper$(filename$),ext$):If eol>0 Then filename$=Mid$(filename$,1,eol+3)
  17.                         If FileType(filename$)<>1 Then ok=ook
  18.                 EndIf
  19.         Until OK<>0
  20. EndIf
  21. If FileType(filename$)=1 Then ret$=filename$
  22. Return ret$
  23. End Function


Comments :


jfk EO-11110(Posted 1+ years ago)

 Very useful, thanks!


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal