mac support fixes
This commit is contained in:
parent
86c7926e94
commit
b1298e9b66
|
@ -86,16 +86,16 @@ wxString MakeReducedFileName( const wxString & fullfilename,
|
|||
/***************************************************************************/
|
||||
|
||||
/* Calcule le nom "reduit" d'un fichier d'apres les chaines
|
||||
fullfilename = nom complet
|
||||
default_path = prefixe (chemin) par defaut
|
||||
default_ext = extension par defaut
|
||||
|
||||
retourne le nom reduit, c'est a dire:
|
||||
sans le chemin si le chemin est default_path
|
||||
avec ./ si si le chemin est le chemin courant
|
||||
sans l'extension si l'extension est default_ext
|
||||
|
||||
Renvoie un chemin en notation unix ('/' en separateur de repertoire)
|
||||
* fullfilename = nom complet
|
||||
* default_path = prefixe (chemin) par defaut
|
||||
* default_ext = extension par defaut
|
||||
*
|
||||
* retourne le nom reduit, c'est a dire:
|
||||
* sans le chemin si le chemin est default_path
|
||||
* avec ./ si si le chemin est le chemin courant
|
||||
* sans l'extension si l'extension est default_ext
|
||||
*
|
||||
* Renvoie un chemin en notation unix ('/' en separateur de repertoire)
|
||||
*/
|
||||
{
|
||||
wxString reduced_filename = fullfilename;
|
||||
|
@ -106,7 +106,8 @@ wxString Cwd, ext, path;
|
|||
path = wxPathOnly( reduced_filename ) + UNIX_STRING_DIR_SEP;
|
||||
reduced_filename.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||
Cwd.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||
if ( Cwd.Last() != '/' ) Cwd += UNIX_STRING_DIR_SEP;
|
||||
if( Cwd.Last() != '/' )
|
||||
Cwd += UNIX_STRING_DIR_SEP;
|
||||
path.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
@ -140,26 +141,24 @@ wxString Cwd, ext, path;
|
|||
if( !ext.IsEmpty() && reduced_filename.Contains( ext ) )
|
||||
reduced_filename.Truncate( reduced_filename.Length() - ext.Length() );
|
||||
|
||||
return(reduced_filename);
|
||||
return reduced_filename;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
wxString MakeFileName( const wxString& dir,
|
||||
const wxString& shortname, const wxString& ext )
|
||||
/***************************************************************************/
|
||||
|
||||
/* Calcule le nom complet d'un fichier d'apres les chaines
|
||||
dir = prefixe (chemin) (peut etre "")
|
||||
shortname = nom avec ou sans chemin ou extension
|
||||
ext = extension (peut etre "")
|
||||
|
||||
si shortname possede deja un chemin ou une extension, elles
|
||||
ne seront pas modifiees
|
||||
|
||||
retourne la chaine calculee
|
||||
* dir = prefixe (chemin) (peut etre "")
|
||||
* shortname = nom avec ou sans chemin ou extension
|
||||
* ext = extension (peut etre "")
|
||||
*
|
||||
* si shortname possede deja un chemin ou une extension, elles
|
||||
* ne seront pas modifiees
|
||||
*
|
||||
* retourne la chaine calculee
|
||||
*/
|
||||
{
|
||||
wxString fullfilename;
|
||||
|
@ -178,7 +177,8 @@ int ii;
|
|||
fullfilename.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||
|
||||
/* Placement de l'extension s'il n'y en a pas deja une */
|
||||
if( ext.IsEmpty() ) return(fullfilename);
|
||||
if( ext.IsEmpty() )
|
||||
return fullfilename;
|
||||
|
||||
/* Recherche d'une eventuelle extension */
|
||||
ii = fullfilename.Length(); /* Pointe la fin du texte */
|
||||
|
@ -194,43 +194,49 @@ int ii;
|
|||
break;
|
||||
}
|
||||
|
||||
return(fullfilename);
|
||||
return fullfilename;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
void ChangeFileNameExt( wxString& FullFileName, const wxString& NewExt )
|
||||
/**************************************************************************/
|
||||
|
||||
/* Change l'extension du "filename FullFileName" en NewExt.
|
||||
*/
|
||||
{
|
||||
wxString FileName;
|
||||
|
||||
FileName = FullFileName.BeforeLast( '.' );
|
||||
if ( !FileName.IsEmpty() ) FileName += NewExt;
|
||||
else FileName = FullFileName + NewExt;
|
||||
if( !FileName.IsEmpty() )
|
||||
FileName += NewExt;
|
||||
else
|
||||
FileName = FullFileName + NewExt;
|
||||
|
||||
if( FileName.StartsWith( wxT( "\"" ) ) && ( FileName.Last() != '"' ) )
|
||||
FileName += wxT( "\"" );
|
||||
FullFileName = FileName;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************/
|
||||
void AddDelimiterString( wxString& string )
|
||||
/*******************************************/
|
||||
|
||||
/* ajoute un " en debut et fin de string s'il n'y en a pas deja.
|
||||
*/
|
||||
{
|
||||
wxString text;
|
||||
|
||||
if ( ! string.StartsWith( wxT("\"")) ) text = wxT("\"");
|
||||
if( !string.StartsWith( wxT( "\"" ) ) )
|
||||
text = wxT( "\"" );
|
||||
text += string;
|
||||
if( (text.Last() != '"' ) || (text.length() <= 1) ) text += wxT("\"");
|
||||
if( (text.Last() != '"' ) || (text.length() <= 1) )
|
||||
text += wxT( "\"" );
|
||||
string = text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************/
|
||||
/* Fonction de selection de Repertoires */
|
||||
/*************************************/
|
||||
|
@ -262,6 +268,7 @@ bool selected = FALSE;
|
|||
return selected;
|
||||
}
|
||||
|
||||
|
||||
/******************************/
|
||||
/* Selection file dialog box: */
|
||||
/******************************/
|
||||
|
@ -283,7 +290,8 @@ wxString defaultpath = Path;
|
|||
|
||||
defaultname.Replace( wxT( "/" ), STRING_DIR_SEP );
|
||||
defaultpath.Replace( wxT( "/" ), STRING_DIR_SEP );
|
||||
if ( defaultpath.IsEmpty() ) defaultpath = wxGetCwd();
|
||||
if( defaultpath.IsEmpty() )
|
||||
defaultpath = wxGetCwd();
|
||||
|
||||
wxSetWorkingDirectory( defaultpath );
|
||||
|
||||
|
@ -296,31 +304,34 @@ wxString defaultpath = Path;
|
|||
Frame,
|
||||
Pos.x, Pos.y );
|
||||
|
||||
if ( keep_working_directory ) wxSetWorkingDirectory(curr_cwd);
|
||||
if( keep_working_directory )
|
||||
wxSetWorkingDirectory( curr_cwd );
|
||||
|
||||
return fullfilename;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
wxString FindKicadHelpPath( void )
|
||||
/********************************************************/
|
||||
/* Find absolute path for kicad/help (or kicad/help/<language>) */
|
||||
|
||||
/* Find path kicad/help/xx/ ou kicad/help/:
|
||||
from BinDir
|
||||
else from environment variable KICAD
|
||||
else from one of s_HelpPathList
|
||||
typically c:\kicad\help or /usr/local/kicad/help or /usr/share/doc/kicad
|
||||
(must have kicad in path name)
|
||||
|
||||
xx = iso639-1 language id (2 letters (generic) or 4 letters):
|
||||
fr = french (or fr_FR)
|
||||
en = English (or en_GB or en_US ...)
|
||||
de = deutch
|
||||
es = spanish
|
||||
pt = portuguese (or pt_BR ...)
|
||||
|
||||
default = en (if not found = fr)
|
||||
|
||||
* from BinDir
|
||||
* else from environment variable KICAD
|
||||
* else from one of s_HelpPathList
|
||||
* typically c:\kicad\help or /usr/local/kicad/help or /usr/share/doc/kicad
|
||||
* (must have kicad in path name)
|
||||
*
|
||||
* xx = iso639-1 language id (2 letters (generic) or 4 letters):
|
||||
* fr = french (or fr_FR)
|
||||
* en = English (or en_GB or en_US ...)
|
||||
* de = deutch
|
||||
* es = spanish
|
||||
* pt = portuguese (or pt_BR ...)
|
||||
*
|
||||
* default = en (if not found = fr)
|
||||
*
|
||||
*/
|
||||
{
|
||||
wxString FullPath, LangFullPath, tmp;
|
||||
|
@ -329,7 +340,8 @@ bool PathFound = FALSE;
|
|||
|
||||
/* find kicad/help/ */
|
||||
tmp = EDA_Appl->m_BinDir;
|
||||
if ( tmp.Last() == '/' ) tmp.RemoveLast();
|
||||
if( tmp.Last() == '/' )
|
||||
tmp.RemoveLast();
|
||||
FullPath = tmp.BeforeLast( '/' ); // Idem cd ..
|
||||
FullPath += wxT( "/help/" );
|
||||
LocaleString = EDA_Appl->m_Locale->GetCanonicalName();
|
||||
|
@ -340,25 +352,29 @@ bool PathFound = FALSE;
|
|||
#endif
|
||||
if( path_tmp.Contains( wxT( "kicad" ) ) )
|
||||
{
|
||||
if ( wxDirExists(FullPath) ) PathFound = TRUE;
|
||||
if( wxDirExists( FullPath ) )
|
||||
PathFound = TRUE;
|
||||
}
|
||||
|
||||
/* find kicad/help/ from environment variable KICAD */
|
||||
if( !PathFound && EDA_Appl->m_Env_Defined )
|
||||
{
|
||||
FullPath = EDA_Appl->m_KicadEnv + wxT( "/help/" );
|
||||
if ( wxDirExists(FullPath) ) PathFound = TRUE;
|
||||
if( wxDirExists( FullPath ) )
|
||||
PathFound = TRUE;
|
||||
}
|
||||
|
||||
/* find kicad/help/ from default path list:
|
||||
/usr/local/kicad/help or c:/kicad/help
|
||||
(see s_HelpPathList) */
|
||||
* /usr/local/kicad/help or c:/kicad/help
|
||||
* (see s_HelpPathList) */
|
||||
int ii = 0;
|
||||
while( !PathFound )
|
||||
{
|
||||
FullPath = s_HelpPathList[ii++];
|
||||
if ( FullPath == wxT("end_list") ) break;
|
||||
if ( wxDirExists(FullPath) ) PathFound = TRUE;
|
||||
if( FullPath == wxT( "end_list" ) )
|
||||
break;
|
||||
if( wxDirExists( FullPath ) )
|
||||
PathFound = TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -366,70 +382,82 @@ bool PathFound = FALSE;
|
|||
{
|
||||
LangFullPath = FullPath + LocaleString + UNIX_STRING_DIR_SEP;
|
||||
|
||||
if ( wxDirExists(LangFullPath) ) return LangFullPath;
|
||||
if( wxDirExists( LangFullPath ) )
|
||||
return LangFullPath;
|
||||
|
||||
LangFullPath = FullPath + LocaleString.Left( 2 ) + UNIX_STRING_DIR_SEP;
|
||||
if ( wxDirExists(LangFullPath) ) return LangFullPath;
|
||||
if( wxDirExists( LangFullPath ) )
|
||||
return LangFullPath;
|
||||
|
||||
LangFullPath = FullPath + wxT( "en/" );
|
||||
if ( wxDirExists(LangFullPath) ) return LangFullPath;
|
||||
if( wxDirExists( LangFullPath ) )
|
||||
return LangFullPath;
|
||||
else
|
||||
{
|
||||
LangFullPath = FullPath + wxT( "fr/" );
|
||||
if ( wxDirExists(LangFullPath) ) return LangFullPath;
|
||||
if( wxDirExists( LangFullPath ) )
|
||||
return LangFullPath;
|
||||
}
|
||||
return FullPath;
|
||||
}
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
wxString FindKicadFile( const wxString& shortname )
|
||||
/********************************************************/
|
||||
/* Search the executable file shortname in kicad binary path
|
||||
and return full file name if found or shortname
|
||||
kicad binary path is
|
||||
kicad/winexe or kicad/linux
|
||||
|
||||
kicad binary path is found from:
|
||||
BinDir
|
||||
or environment variable KICAD
|
||||
or (default) c:\kicad ou /usr/local/kicad
|
||||
or default binary path
|
||||
/* Search the executable file shortname in kicad binary path
|
||||
* and return full file name if found or shortname
|
||||
* kicad binary path is
|
||||
* kicad/winexe or kicad/linux
|
||||
*
|
||||
* kicad binary path is found from:
|
||||
* BinDir
|
||||
* or environment variable KICAD
|
||||
* or (default) c:\kicad ou /usr/local/kicad
|
||||
* or default binary path
|
||||
*/
|
||||
{
|
||||
wxString FullFileName;
|
||||
|
||||
/* test de la presence du fichier shortname dans le repertoire de
|
||||
des binaires de kicad */
|
||||
* des binaires de kicad */
|
||||
FullFileName = EDA_Appl->m_BinDir + shortname;
|
||||
if ( wxFileExists(FullFileName) ) return FullFileName;
|
||||
if( wxFileExists( FullFileName ) )
|
||||
return FullFileName;
|
||||
|
||||
/* test de la presence du fichier shortname dans le repertoire
|
||||
defini par la variable d'environnement KICAD */
|
||||
* defini par la variable d'environnement KICAD */
|
||||
if( EDA_Appl->m_Env_Defined )
|
||||
{
|
||||
FullFileName = EDA_Appl->m_KicadEnv + shortname;
|
||||
if ( wxFileExists(FullFileName) ) return FullFileName;
|
||||
if( wxFileExists( FullFileName ) )
|
||||
return FullFileName;
|
||||
}
|
||||
|
||||
/* find binary file from default path list:
|
||||
/usr/local/kicad/linux or c:/kicad/winexe
|
||||
(see s_KicadDataPathList) */
|
||||
* /usr/local/kicad/linux or c:/kicad/winexe
|
||||
* (see s_KicadDataPathList) */
|
||||
int ii = 0;
|
||||
while( 1 )
|
||||
{
|
||||
if ( s_KicadBinaryPathList[ii] == wxT("end_list") ) break;
|
||||
if( s_KicadBinaryPathList[ii] == wxT( "end_list" ) )
|
||||
break;
|
||||
FullFileName = s_KicadBinaryPathList[ii++] + shortname;
|
||||
if ( wxFileExists(FullFileName) ) return FullFileName;
|
||||
if( wxFileExists( FullFileName ) )
|
||||
return FullFileName;
|
||||
}
|
||||
|
||||
return shortname;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************/
|
||||
int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& param )
|
||||
/***********************************************************************************/
|
||||
|
||||
/* Call the executable file "ExecFile", with params "param"
|
||||
*/
|
||||
{
|
||||
|
@ -437,9 +465,10 @@ wxString FullFileName;
|
|||
|
||||
|
||||
#ifdef __WXMAC__
|
||||
|
||||
// Mac part
|
||||
wxGetEnv( "HOME", &FullFileName );
|
||||
FullFileName += wxString("/bin/") + newExecFile;
|
||||
FullFileName += wxString( "/bin/" ) + ExecFile;
|
||||
if( !wxFileExists( FullFileName ) )
|
||||
{
|
||||
FullFileName = FindKicadFile( ExecFile );
|
||||
|
@ -451,7 +480,8 @@ wxString FullFileName;
|
|||
|
||||
if( wxFileExists( FullFileName ) )
|
||||
{
|
||||
if( !param.IsEmpty() ) FullFileName += wxT(" ") + param;
|
||||
if( !param.IsEmpty() )
|
||||
FullFileName += wxT( " " ) + param;
|
||||
wxExecute( FullFileName );
|
||||
return 0;
|
||||
}
|
||||
|
@ -466,16 +496,17 @@ wxString FullFileName;
|
|||
/****************************************************/
|
||||
void SetRealLibraryPath( const wxString& shortlibname )
|
||||
/****************************************************/
|
||||
/* met a jour le chemin des librairies g_RealLibDirBuffer (global)
|
||||
a partir de UserLibDirBuffer (global):
|
||||
Si UserLibDirBuffer non vide g_RealLibDirBuffer = g_UserLibDirBuffer.
|
||||
Sinon si variable d'environnement KICAD definie (KICAD = chemin pour kicad),
|
||||
g_UserLibDirBuffer = <KICAD>/shortlibname;
|
||||
Sinon g_UserLibDirBuffer = <Chemin des binaires>../shortlibname/
|
||||
Sinon g_UserLibDirBuffer = /usr/share/kicad/shortlibname/
|
||||
|
||||
Remarque:
|
||||
Les \ sont remplacés par / (a la mode Unix)
|
||||
/* met a jour le chemin des librairies g_RealLibDirBuffer (global)
|
||||
* a partir de UserLibDirBuffer (global):
|
||||
* Si UserLibDirBuffer non vide g_RealLibDirBuffer = g_UserLibDirBuffer.
|
||||
* Sinon si variable d'environnement KICAD definie (KICAD = chemin pour kicad),
|
||||
* g_UserLibDirBuffer = <KICAD>/shortlibname;
|
||||
* Sinon g_UserLibDirBuffer = <Chemin des binaires>../shortlibname/
|
||||
* Sinon g_UserLibDirBuffer = /usr/share/kicad/shortlibname/
|
||||
*
|
||||
* Remarque:
|
||||
* Les \ sont remplacés par / (a la mode Unix)
|
||||
*/
|
||||
{
|
||||
bool PathFound = FALSE;
|
||||
|
@ -485,7 +516,6 @@ bool PathFound = FALSE;
|
|||
g_RealLibDirBuffer = g_UserLibDirBuffer;
|
||||
PathFound = TRUE;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
g_RealLibDirBuffer = ReturnKicadDatasPath();
|
||||
|
@ -494,25 +524,29 @@ bool PathFound = FALSE;
|
|||
PathFound = TRUE;
|
||||
}
|
||||
g_RealLibDirBuffer += shortlibname;
|
||||
if ( wxDirExists(g_RealLibDirBuffer) ) PathFound = TRUE;
|
||||
if( wxDirExists( g_RealLibDirBuffer ) )
|
||||
PathFound = TRUE;
|
||||
}
|
||||
|
||||
|
||||
g_RealLibDirBuffer.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||
if ( g_RealLibDirBuffer.Last() != '/' ) g_RealLibDirBuffer += UNIX_STRING_DIR_SEP;
|
||||
if( g_RealLibDirBuffer.Last() != '/' )
|
||||
g_RealLibDirBuffer += UNIX_STRING_DIR_SEP;
|
||||
}
|
||||
|
||||
|
||||
/***********************************/
|
||||
wxString ReturnKicadDatasPath( void )
|
||||
/***********************************/
|
||||
/* Retourne le chemin des donnees communes de kicad.
|
||||
Si variable d'environnement KICAD definie (KICAD = chemin pour kicad),
|
||||
retourne <KICAD>/;
|
||||
Sinon retourne <Chemin des binaires>/ (si "kicad" est dans le nom du chemin)
|
||||
Sinon retourne /usr/share/kicad/
|
||||
|
||||
Remarque:
|
||||
Les \ sont remplacés par / (a la mode Unix)
|
||||
/* Retourne le chemin des donnees communes de kicad.
|
||||
* Si variable d'environnement KICAD definie (KICAD = chemin pour kicad),
|
||||
* retourne <KICAD>/;
|
||||
* Sinon retourne <Chemin des binaires>/ (si "kicad" est dans le nom du chemin)
|
||||
* Sinon retourne /usr/share/kicad/
|
||||
*
|
||||
* Remarque:
|
||||
* Les \ sont remplacés par / (a la mode Unix)
|
||||
*/
|
||||
{
|
||||
bool PathFound = FALSE;
|
||||
|
@ -524,7 +558,8 @@ wxString data_path;
|
|||
PathFound = TRUE;
|
||||
}
|
||||
else // Chemin cherche par le chemin des executables
|
||||
{ // le chemin est bindir../
|
||||
{
|
||||
// le chemin est bindir../
|
||||
wxString tmp = EDA_Appl->m_BinDir;
|
||||
#ifdef __WINDOWS__
|
||||
tmp.MakeLower();
|
||||
|
@ -534,31 +569,36 @@ wxString data_path;
|
|||
#ifdef __WINDOWS__
|
||||
tmp = EDA_Appl->m_BinDir;
|
||||
#endif
|
||||
if ( tmp.Last() == '/' ) tmp.RemoveLast();
|
||||
if( tmp.Last() == '/' )
|
||||
tmp.RemoveLast();
|
||||
data_path = tmp.BeforeLast( '/' ); // id cd ../
|
||||
data_path += UNIX_STRING_DIR_SEP;
|
||||
if ( wxDirExists(data_path) ) PathFound = TRUE;
|
||||
if( wxDirExists( data_path ) )
|
||||
PathFound = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* find kicad from default path list:
|
||||
/usr/local/kicad/ or c:/kicad/
|
||||
(see s_KicadDataPathList) */
|
||||
* /usr/local/kicad/ or c:/kicad/
|
||||
* (see s_KicadDataPathList) */
|
||||
int ii = 0;
|
||||
while( !PathFound )
|
||||
{
|
||||
if ( s_KicadDataPathList[ii] == wxT("end_list") ) break;
|
||||
if( s_KicadDataPathList[ii] == wxT( "end_list" ) )
|
||||
break;
|
||||
data_path = s_KicadDataPathList[ii++];
|
||||
if ( wxDirExists(data_path) ) PathFound = TRUE;
|
||||
if( wxDirExists( data_path ) )
|
||||
PathFound = TRUE;
|
||||
}
|
||||
|
||||
if( PathFound )
|
||||
{
|
||||
data_path.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||
if ( data_path.Last() != '/' ) data_path += UNIX_STRING_DIR_SEP;
|
||||
if( data_path.Last() != '/' )
|
||||
data_path += UNIX_STRING_DIR_SEP;
|
||||
}
|
||||
|
||||
else data_path.Empty();
|
||||
else
|
||||
data_path.Empty();
|
||||
|
||||
return data_path;
|
||||
}
|
||||
|
@ -567,6 +607,7 @@ wxString data_path;
|
|||
/***************************/
|
||||
wxString GetEditorName( void )
|
||||
/***************************/
|
||||
|
||||
/* Return the prefered editor name
|
||||
*/
|
||||
{
|
||||
|
@ -580,6 +621,7 @@ wxString GetEditorName(void)
|
|||
{
|
||||
DisplayInfo( NULL, _( "No default editor found, you must choose it" ) );
|
||||
wxString mask( wxT( "*" ) );
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
mask += wxT( ".exe" );
|
||||
#endif
|
||||
|
@ -602,6 +644,7 @@ wxString GetEditorName(void)
|
|||
return g_EditorName;
|
||||
}
|
||||
|
||||
|
||||
void OpenPDF( const wxString& file )
|
||||
{
|
||||
wxString command;
|
||||
|
@ -620,8 +663,10 @@ void OpenPDF( const wxString & file )
|
|||
wxFileType* filetype = NULL;
|
||||
|
||||
wxFileType::MessageParameters params( filename, type );
|
||||
|
||||
filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( wxT( ".pdf" ) );
|
||||
if (filetype ) success = filetype->GetOpenCommand( &command, params);
|
||||
if( filetype )
|
||||
success = filetype->GetOpenCommand( &command, params );
|
||||
delete filetype;
|
||||
|
||||
if( !success )
|
||||
|
@ -638,7 +683,8 @@ void OpenPDF( const wxString & file )
|
|||
};
|
||||
for( int i = 0; ; i++ )
|
||||
{
|
||||
if (tries[i].IsEmpty()) break;
|
||||
if( tries[i].IsEmpty() )
|
||||
break;
|
||||
if( wxFileExists( tries[i] ) )
|
||||
{
|
||||
command = tries[i] + wxT( " " ) + filename;
|
||||
|
@ -647,7 +693,8 @@ void OpenPDF( const wxString & file )
|
|||
}
|
||||
}
|
||||
|
||||
if (!command.IsEmpty()) wxExecute(command);
|
||||
if( !command.IsEmpty() )
|
||||
wxExecute( command );
|
||||
}
|
||||
|
||||
|
||||
|
@ -658,14 +705,17 @@ void OpenFile( const wxString & file )
|
|||
|
||||
wxFileName CurrentFileName( filename );
|
||||
wxString ext, type;
|
||||
|
||||
ext = CurrentFileName.GetExt();
|
||||
wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( ext );
|
||||
|
||||
bool success = false;
|
||||
|
||||
wxFileType::MessageParameters params( filename, type );
|
||||
if (filetype) success = filetype->GetOpenCommand( &command, params);
|
||||
if( filetype )
|
||||
success = filetype->GetOpenCommand( &command, params );
|
||||
delete filetype;
|
||||
|
||||
if (success && !command.IsEmpty()) wxExecute(command);
|
||||
if( success && !command.IsEmpty() )
|
||||
wxExecute( command );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue