IDE-Tool : Assign (Windows)

Du brauchst Grafiken, gute Programme oder Leute die dir helfen? Frag hier.
Benutzeravatar
Bisonte
Beiträge: 2430
Registriert: 01.04.2007 20:18

IDE-Tool : Assign (Windows)

Beitrag von Bisonte »

Hallo.

Dieses kleine IDE-Tool weist einem Laufwerksbuchstaben einen Pfad zu.
Damit kann man dann z.B. sein Include Verzeichnis mit einem Laufwerksbuchstaben
ansprechen.

Code: Alles auswählen

XIncludeFile "P:\MeinInclude.pbi"
Die Idee entstand als ich mal wieder den Includeordner kopieren wollte.... so hab ich nur noch einen
trotz der in letzter Zeit häufigen PB-Updates und x64/x86 Versionen.

Hier das Listing

Code: Alles auswählen

; _____________________________________________________________________________
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; »»» Project  : IDE-Tool - Assign
; »»» Author   : George Bisonte
; »»» Version  : 1.0
; »»» Compiler : PureBasic 5.10 (Windows - x86)
; »»» created  : 27.02.2013 - 04:23
; »»» Flags    : [ ]ASM       [ ]Unicode  [ ]Thread  [ ]XP-Skin
; »»»            [ ]AdminMode [ ]Usermode [ ]OnError [ ]Purifier
; _____________________________________________________________________________
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; Configure as
;
; Commandline: Driveletter "PathToDirectory" Messages
; Example : P "C:\PureBasic\Includes\" 1 -> Assign P:\ to C:\PureBasic\Includes\ and Display Error Messages if an error...
;
; Trigger: "Editor Start"
; [x] Hide tool from the Main menu
;
EnableExplicit

Define.s DriveLetter, Path
Define   Messages, Directory, Result

DriveLetter = ProgramParameter(0)
Path        = ProgramParameter(1)
Messages    = Val(ProgramParameter(2))

Directory = ExamineDirectory(#PB_Any, DriveLetter + ":\", "")

If Directory 
  FinishDirectory(Directory)
  Result = 3
Else
  If FileSize(Path) = -2
    DefineDosDevice_(0,DriveLetter + ":",Path)
    Result = 2
  Else
    Result = 1
  EndIf
EndIf

If Messages
  Select Result
    Case 1
      MessageRequester("Error","Could not assign "+DriveLetter+": to "+Path)
    Case 2
      ; All Ok
    Case 3
      MessageRequester("Error","Already assigned "+DriveLetter+": to "+Path)
  EndSelect
EndIf

End
PureBasic 6.10 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​