FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1
|
||||
|
||||
Obtener el Path de TEMP de windows sin ~
Necesito obtener el path del directorio temporal de un usuario de windows, tanto 98 como xp, pero todas las opciones que he probado me resume los directorios con el caracter ~. Por ejemplo: C:\DOCUME~1\luis\CONFIG~1\Temp\
He probado esto: Código:
function TDatos.GetWindowsTemp(): String; var Path: array[0..MAX_PATH] of Char; begin GetTempPath(SizeOf(Path), Path); Result:=Path; end; Código:
Result := IncludeTrailingPathDelimiter(GetEnvironmentVariable('TEMP')); Un saludo. |
#2
|
||||
|
||||
Hola,
Bueno. Lo que obtienes es la "ruta corta" del archivo, y creo que debería funcionarte igualmente. Pero, de todos modos... Hace poco me ví en la necesidad de obtener los directorios del sistema, y, aunque ya había hecho algo así, esta vez fui un poco más allá y con la unidad que adjunto, como verás, pueden obtenerse directorios de hasta Windows Vista. Si no quieres usar toda la unidad, quédate con cómo se lleva a cabo lo que precisas, o, en defintiva, haz los cambios que creas oportunos:
Nota: He quitado dos métodos a métodos a la clase que ves: "CSIDLToString" y "StringToCDIDL", puesto que los veo muy específicos para mi proyecto. Si los necesitas no tienes sino decirlo. Última edición por dec fecha: 23-07-2008 a las 20:15:40. |
#3
|
||||
|
||||
#4
|
||||
|
||||
Es curioso, pero estaba a punto de hacer casi exáctamente la misma pregunta que el compañero apicito.
Ya he copiado el código para utilizarlo. Gracias a ambos. |
#5
|
||||
|
||||
Gracias dec. He utilizado la primera opción de este modo me queda implementada la posibilidad futura de obtener otros paths.
Un saludo. |
#6
|
|||
|
|||
Se Agradece
Gran aporte... simplemente genial.
|
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
obtener el path de un archivo | ercrizeporta | Varios | 1 | 27-05-2007 07:13:13 |
obtener path de un TDialog | ancara | SQL | 8 | 08-05-2007 10:55:26 |
Obtener PATH del ejecutable | emeceuy | Varios | 7 | 25-01-2006 17:59:46 |
Obtener el path del ejecutable del internet Explorer | cone220 | Varios | 9 | 27-05-2004 01:34:02 |
|