Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Drive Mapping
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Divers
Thread ID:
00425895
Message ID:
00425929
Vues:
18
>Thanks.
>
>Thats what we've actually done. But it gets tricky where users have specified explicit paths including drive letters.

I encountered the same sort of problem when upgrading my existing FPW 2.6a systems into VFP. What I did was along the lines of the following snippet.
* assumes the cDataField is part of a table with the alias AppData
* the data field allowed the path to be stored with or without the drive specifier.
lcpath = AppData.cDataField
IF NOT EMPTY(JUSTDRIVE(lcpath))
  lcpath = SUBSTR(lcpath, 3) && Remove the drive from the path
ENDIF
lndrive = 67 && ASCII 'C'
lnlast = 90 && ASCII 'Z'
llfound = .F.
lcresult = ""
DO WHILE NOT llfound AND lndrive < lnlast
  lndrive = lndrive + 1
  IF DRIVETYPE(CHR(lndrive)) = 4 && Network drive
    llfound = (DIRECTORY(CHR(lndrive) + ":" + lcpath))
  ENDIF
ENDDO
IF llfound
  lcresult = CHR(lndrive) + ":" + lcpath
ELSE
  lcresult = lcpath
ENDIF
In the above you could use logic utilizing the JUSTDRIVE() function to determine if there was a drive mapped. If so, you'd simply use the path provided. Otherwise, use the UNC plus the path.

This help?
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform