Cómo Puedo Obtener La Ruta Del Directorio Donde El Archivo Se Abre?


Subject: Cómo Puedo Obtener La Ruta Del Directorio Donde El Archivo Se Abre?
Hola a todos

Estoy haciendo algunas pruebas en ejemplo "Notepad 3.0" que viene en gambas3.

Cuando abro un archivo de texto en este "Notepad", me di cuenta de que la ruta del archivo de texto está en Dialog.Path (por ejemplo, /home/edivaldo/arquivo.txt), que es la rutina:

Public Sub mnuOpen_Click()

Dim sPath As String

Dialog.Filter = ["*", ("All files"), "*.{c;cpp;h}", ("C/C++ files"), "*.txt", ("Text files"), "*.desktop", ("Desktop files")]

If Dialog.OpenFile() Then Return
LoadFile(Dialog.Path)

End


Mi pregunta es: ¿Cómo puedo obtener sólo la ruta del directorio donde el archivo se abre en el texto? (Por ejemplo: /home/edivaldo/ )

Doy las gracias a la atención

Profile PM  
Subject: Re: Cómo Puedo Obtener La Ruta Del Directorio Donde El Archivo Se Abre?
a ver si te sirve esto

Public Sub mnuOpen_Click()

Dim sPath As String

Dialog.Filter = ["*", ("All files"), "*.{c;cpp;h}", ("C/C++ files"), "*.txt", ("Text files"), "*.desktop", ("Desktop files")]

If Dialog.OpenFile() Then Return
File.Load(Dialog.Path)
sPath = File.Dir(Dialog.Path)
Print sPath

End

Last edited by v3ctor on Thursday, 24 April 2014, 23:30; edited 2 times in total
Subject: Re: Cómo Puedo Obtener La Ruta Del Directorio Donde El Archivo Se Abre? [RESUELTO]
v3ctor escribió: [Ver mensaje]
a ver si te sirve esto

Public Sub mnuOpen_Click()

Dim sPath As String

Dialog.Filter = ["*", ("All files"), "*.{c;cpp;h}", ("C/C++ files"), "*.txt", ("Text files"), "*.desktop", ("Desktop files")]

If Dialog.OpenFile() Then Return
File.Load(Dialog.Path)
sPath = File.Dir(Dialog.Path)
Print sPath

End



¡Gracias! Funcionó.
Yo estaba tratando de hacer esto por tres días

Profile PM  

Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Design by DiDiDaDo

Generation Time: 0.1093s (PHP: -31% SQL: 131%)
SQL queries: 24 - Debug Off - GZIP Enabled