Herausfinen, ob ein Pfad absolut oder relativ ist

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Herausfinen, ob ein Pfad absolut oder relativ ist

Re: Herausfinen, ob ein Pfad absolut oder relativ ist

Post by bichlepa » 11 Jun 2015, 13:29

:dance: Cool! Vielen Dank!

Re: Herausfinen, ob ein Pfad absolut oder relativ ist

Post by HotKeyIt » 11 Jun 2015, 12:17

PathIsRelative on MSDN.

Code: Select all

DllCall("Shlwapi.dll\PathIsRelative","Str",Path)

Herausfinen, ob ein Pfad absolut oder relativ ist

Post by bichlepa » 11 Jun 2015, 09:29

Ich möchte in AutoHotFlow erlauben, dass der Benutzer bei der Angabe von Dateipfaden auch relative Pfade verwenden kann, und zuvor definieren kann, wo sich das Arbeitsverzeichnis befindet.
Das Problem liegt darin, dass ich im Code sehr viel mit relativen Pfaden arbeite und somit das interne Arbeitsverzeichnis von AHK für das funktionieren von AutoHotFlow brauche.
Mein Ansatz ist daher, den vom Benutzer eingegebenen Pfad daraufhin zu untersuchen, ob er absolut oder relativ ist, und, falls relativ, das vom Benutzer definierte Arbeitsverzeichnis anzufügen.

Daher meine Frage:
Wie finde ich heraus, ob ein Pfad in einem String absolut oder relativ ist?

Ich habe mir folgendes überlegt:
- nach einem Doppelpunkt suchen ( -> Pfad auf einem Computerlaufwerk)
- schauen, ob der Pfad mit \\ beginnt (-> Pfad im Netzwerk).
Alles andere wäre dann ein relativer Pfad. Ich weiß aber nicht, ob das alle möglichen Pfade abdecken würde.

Top