@@ -404,34 +404,48 @@ def __init__(self, parent):
404404
405405 def onCreatePortable (self , evt ):
406406 if not self .portableDirectoryEdit .Value :
407- # Translators: The message displayed when the user has not specified a destination directory
408- # in the Create Portable NVDA dialog.
409- gui .messageBox (_ ("Please specify a directory in which to create the portable copy." ),
407+ gui .messageBox (
408+ # Translators: The message displayed when the user has not specified a destination directory
409+ # in the Create Portable NVDA dialog.
410+ _ ("Please specify a directory in which to create the portable copy." ),
411+ # Translators: the title of an error dialog.
410412 _ ("Error" ),
411- wx .OK | wx .ICON_ERROR )
413+ wx .OK | wx .ICON_ERROR
414+ )
412415 return
413- if not os .path .isabs (self .portableDirectoryEdit .Value ):
416+ expandedPortableDirectory = os .path .expandvars (self .portableDirectoryEdit .Value )
417+ if not os .path .isabs (expandedPortableDirectory ):
414418 gui .messageBox (
415- # Translators: The message displayed when the user has not specified an absolute destination directory
416- # in the Create Portable NVDA dialog.
417- _ ("Please specify an absolute path (including drive letter) in which to create the portable copy." ),
418- # Translators: The message title displayed
419- # when the user has not specified an absolute destination directory
420- # in the Create Portable NVDA dialog.
419+ _ (
420+ # Translators: The message displayed when the user has not specified an absolute destination directory
421+ # in the Create Portable NVDA dialog.
422+ "Please specify the absolute path where the portable copy should be created. "
423+ "It may include system variables (%temp%, %homepath%, etc.)."
424+ ),
425+ # Translators: The message title displayed when the user has not specified an absolute
426+ # destination directory in the Create Portable NVDA dialog.
421427 _ ("Error" ),
422428 wx .OK | wx .ICON_ERROR
423429 )
424430 return
425- drv = os .path .splitdrive (self . portableDirectoryEdit . Value )[0 ]
431+ drv = os .path .splitdrive (expandedPortableDirectory )[0 ]
426432 if drv and not os .path .isdir (drv ):
427- # Translators: The message displayed when the user specifies an invalid destination drive
428- # in the Create Portable NVDA dialog.
429- gui .messageBox (_ ("Invalid drive %s" )% drv ,
433+ gui .messageBox (
434+ # Translators: The message displayed when the user specifies an invalid destination drive
435+ # in the Create Portable NVDA dialog.
436+ _ ("Invalid drive ({drive})." ).format (drive = drv ),
437+ # Translators: the title of an error dialog.
430438 _ ("Error" ),
431- wx .OK | wx .ICON_ERROR )
439+ wx .OK | wx .ICON_ERROR
440+ )
432441 return
433442 self .Hide ()
434- doCreatePortable (self .portableDirectoryEdit .Value ,self .copyUserConfigCheckbox .Value ,False ,self .startAfterCreateCheckbox .Value )
443+ doCreatePortable (
444+ expandedPortableDirectory ,
445+ self .copyUserConfigCheckbox .Value ,
446+ False ,
447+ self .startAfterCreateCheckbox .Value
448+ )
435449 self .Destroy ()
436450
437451 def onCancel (self , evt ):
0 commit comments