2011-12-16 20:12:49 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
|
|
|
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/**
|
|
|
|
* @file gestfich.cpp
|
|
|
|
* @brief Functions for file management
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
// For compilers that support precompilation, includes "wx.h".
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <appl_wxstruct.h>
|
|
|
|
#include <confirm.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <common.h>
|
|
|
|
#include <macros.h>
|
|
|
|
#include <gestfich.h>
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <wx/mimetype.h>
|
|
|
|
#include <wx/filename.h>
|
2012-01-26 19:48:45 +00:00
|
|
|
#include <wx/dir.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/* List of default paths used to locate help files and KiCad library files.
|
2008-03-30 15:12:08 +00:00
|
|
|
*
|
2011-09-30 18:15:37 +00:00
|
|
|
* Under windows, KiCad search its files from the binary path file (first
|
2009-11-23 15:16:50 +00:00
|
|
|
* argument when running "main") So for a standard install, default paths
|
|
|
|
* are not mandatory, but they exist, just in case.
|
2011-09-30 18:15:37 +00:00
|
|
|
* KiCad is often installed in c:/Program Files/kicad or c:/kicad (or d: or
|
2009-11-23 15:16:50 +00:00
|
|
|
* e: ... ) and the directory "share" has no meaning under windows.
|
2008-03-30 15:12:08 +00:00
|
|
|
*
|
|
|
|
* Under linux, the problem is more complex.
|
|
|
|
* In fact there are 3 cases:
|
|
|
|
* 1 - When released in a distribution:
|
2011-09-30 18:15:37 +00:00
|
|
|
* binaries are in /usr/bin, KiCad libs in /usr/share/kicad/ and doc in
|
2009-11-23 15:16:50 +00:00
|
|
|
* /usr/share/doc/kicad/
|
2008-03-30 15:12:08 +00:00
|
|
|
* 2 - When compiled by an user:
|
2011-09-30 18:15:37 +00:00
|
|
|
* binaries also can be in /usr/local/bin, KiCad libs in
|
2009-11-23 15:16:50 +00:00
|
|
|
* /usr/local/share/kicad/ and doc in /usr/local/share/doc/kicad/
|
2008-03-30 15:12:08 +00:00
|
|
|
* 3 - When in an "universal tarball" or build for a server:
|
|
|
|
* all files are in /usr/local/kicad
|
2011-09-30 18:15:37 +00:00
|
|
|
* This is mandatory when KiCad is installed on a server (in a school for
|
2009-11-23 15:16:50 +00:00
|
|
|
* instance) because one can export /usr/local/kicad and obviously the others
|
|
|
|
* paths cannot be used (cannot be mounted by the client, because they are
|
|
|
|
* already used).
|
2008-03-30 15:12:08 +00:00
|
|
|
*
|
2011-09-30 18:15:37 +00:00
|
|
|
* in cases 1 and 2 KiCad files cannot be found from the binary path.
|
|
|
|
* in case 3 KiCad files can be found from the binary path only if this is
|
|
|
|
* a KiCad binary file which is launched.
|
2009-11-23 15:16:50 +00:00
|
|
|
* But if an user creates a symbolic link to the actual binary file to run
|
2011-09-30 18:15:37 +00:00
|
|
|
* KiCad, the binary path is not good and the defaults paths must be used
|
2008-03-30 15:12:08 +00:00
|
|
|
*
|
|
|
|
* Note:
|
2011-09-30 18:15:37 +00:00
|
|
|
* KiCad uses first the bin path lo locate KiCad tree.
|
|
|
|
* if not found KiCad uses the environment variable KICAD to find its files
|
|
|
|
* and at last KiCad uses the default paths.
|
2008-03-30 15:12:08 +00:00
|
|
|
* So we can export (linux and windows) the variable KICAD:
|
|
|
|
* like export KICAD=/my_path/kicad if /my_path/kicad is not a default path
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
// Path list for online help
|
2007-08-18 11:43:59 +00:00
|
|
|
static wxString s_HelpPathList[] = {
|
2007-05-06 16:03:28 +00:00
|
|
|
#ifdef __WINDOWS__
|
2008-03-06 19:57:06 +00:00
|
|
|
wxT( "c:/kicad/doc/help/" ),
|
|
|
|
wxT( "d:/kicad/doc/help/" ),
|
|
|
|
wxT( "c:/Program Files/kicad/doc/help/" ),
|
|
|
|
wxT( "d:/Program Files/kicad/doc/help/" ),
|
2007-05-06 16:03:28 +00:00
|
|
|
#else
|
2008-03-06 19:57:06 +00:00
|
|
|
wxT( "/usr/share/doc/kicad/help/" ),
|
|
|
|
wxT( "/usr/local/share/doc/kicad/help/" ),
|
2009-11-23 15:16:50 +00:00
|
|
|
wxT( "/usr/local/kicad/doc/help/" ), // default install for "universal
|
|
|
|
// tarballs" and build for a server
|
|
|
|
// (new)
|
|
|
|
wxT( "/usr/local/kicad/help/" ), // default install for "universal
|
|
|
|
// tarballs" and build for a server
|
|
|
|
// (old)
|
2007-05-06 16:03:28 +00:00
|
|
|
#endif
|
2009-11-23 15:16:50 +00:00
|
|
|
wxT( "end_list" ) // End of list symbol, do not change
|
2007-05-06 16:03:28 +00:00
|
|
|
};
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
// Path list for KiCad data files
|
2007-08-18 11:43:59 +00:00
|
|
|
static wxString s_KicadDataPathList[] = {
|
2007-05-06 16:03:28 +00:00
|
|
|
#ifdef __WINDOWS__
|
2008-03-05 07:16:43 +00:00
|
|
|
wxT( "c:/kicad/share/" ),
|
|
|
|
wxT( "d:/kicad/share/" ),
|
2008-06-22 08:54:05 +00:00
|
|
|
wxT( "c:/kicad/" ),
|
|
|
|
wxT( "d:/kicad/" ),
|
2008-03-06 19:57:06 +00:00
|
|
|
wxT( "c:/Program Files/kicad/share/" ),
|
|
|
|
wxT( "d:/Program Files/kicad/share/" ),
|
2008-06-22 08:54:05 +00:00
|
|
|
wxT( "c:/Program Files/kicad/" ),
|
|
|
|
wxT( "d:/Program Files/kicad/" ),
|
2007-05-06 16:03:28 +00:00
|
|
|
#else
|
2007-08-18 11:43:59 +00:00
|
|
|
wxT( "/usr/share/kicad/" ),
|
|
|
|
wxT( "/usr/local/share/kicad/" ),
|
2009-11-23 15:16:50 +00:00
|
|
|
wxT( "/usr/local/kicad/share/" ), // default data path for "universal
|
|
|
|
// tarballs" and build for a server
|
|
|
|
// (new)
|
|
|
|
wxT( "/usr/local/kicad/" ), // default data path for "universal
|
|
|
|
// tarballs" and build for a server
|
|
|
|
// (old)
|
2007-05-06 16:03:28 +00:00
|
|
|
#endif
|
2009-11-23 15:16:50 +00:00
|
|
|
wxT( "end_list" ) // End of list symbol, do not change
|
2007-05-06 16:03:28 +00:00
|
|
|
};
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
// Path list for KiCad binary files
|
2007-08-18 11:43:59 +00:00
|
|
|
static wxString s_KicadBinaryPathList[] = {
|
2007-05-06 16:03:28 +00:00
|
|
|
#ifdef __WINDOWS__
|
2008-03-05 07:16:43 +00:00
|
|
|
wxT( "c:/kicad/bin/" ),
|
|
|
|
wxT( "d:/kicad/bin/" ),
|
2008-03-06 19:57:06 +00:00
|
|
|
wxT( "c:/Program Files/kicad/bin/" ),
|
|
|
|
wxT( "d:/Program Files/kicad/bin/" ),
|
2007-05-06 16:03:28 +00:00
|
|
|
#else
|
2007-08-18 11:43:59 +00:00
|
|
|
wxT( "/usr/bin/" ),
|
|
|
|
wxT( "/usr/local/bin/" ),
|
|
|
|
wxT( "/usr/local/kicad/bin/" ),
|
2007-05-06 16:03:28 +00:00
|
|
|
#endif
|
2009-11-23 15:16:50 +00:00
|
|
|
wxT( "end_list" ) // End of list symbol, do not change
|
2007-05-06 16:03:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
wxString MakeReducedFileName( const wxString& fullfilename,
|
|
|
|
const wxString& default_path,
|
|
|
|
const wxString& default_ext )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-18 11:43:59 +00:00
|
|
|
wxString reduced_filename = fullfilename;
|
|
|
|
wxString Cwd, ext, path;
|
|
|
|
|
|
|
|
Cwd = default_path;
|
|
|
|
ext = default_ext;
|
|
|
|
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 );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( Cwd.Last() != '/' )
|
|
|
|
Cwd += UNIX_STRING_DIR_SEP;
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
path.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#ifdef __WINDOWS__
|
2008-03-30 15:12:08 +00:00
|
|
|
|
2008-02-20 19:12:36 +00:00
|
|
|
// names are case insensitive under windows
|
2007-08-18 11:43:59 +00:00
|
|
|
path.MakeLower();
|
|
|
|
Cwd.MakeLower();
|
|
|
|
ext.MakeLower();
|
2007-05-06 16:03:28 +00:00
|
|
|
#endif
|
|
|
|
|
2007-11-02 17:17:44 +00:00
|
|
|
// if the path is "default_path" -> remove it
|
2007-08-18 11:43:59 +00:00
|
|
|
wxString root_path = path.Left( Cwd.Length() );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( root_path == Cwd )
|
|
|
|
{
|
|
|
|
reduced_filename.Remove( 0, Cwd.Length() );
|
|
|
|
}
|
2007-11-02 17:17:44 +00:00
|
|
|
else // if the path is the current path -> change path to ./
|
2007-08-18 11:43:59 +00:00
|
|
|
{
|
|
|
|
Cwd = wxGetCwd() + UNIX_STRING_DIR_SEP;
|
2007-05-06 16:03:28 +00:00
|
|
|
#ifdef __WINDOWS__
|
2007-08-18 11:43:59 +00:00
|
|
|
Cwd.MakeLower();
|
2007-05-06 16:03:28 +00:00
|
|
|
#endif
|
2007-08-18 11:43:59 +00:00
|
|
|
Cwd.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( path == Cwd )
|
2007-11-02 17:17:44 +00:00
|
|
|
{ // the path is the current path -> path = "./"
|
2007-08-18 11:43:59 +00:00
|
|
|
reduced_filename.Remove( 0, Cwd.Length() );
|
|
|
|
wxString tmp = wxT( "./" ) + reduced_filename;
|
|
|
|
reduced_filename = tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-02 17:17:44 +00:00
|
|
|
// remove extension if == default_ext:
|
2007-08-18 11:43:59 +00:00
|
|
|
if( !ext.IsEmpty() && reduced_filename.Contains( ext ) )
|
|
|
|
reduced_filename.Truncate( reduced_filename.Length() - ext.Length() );
|
|
|
|
|
|
|
|
return reduced_filename;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
void AddDelimiterString( wxString& string )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-18 11:43:59 +00:00
|
|
|
wxString text;
|
|
|
|
|
|
|
|
if( !string.StartsWith( wxT( "\"" ) ) )
|
|
|
|
text = wxT( "\"" );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
text += string;
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( (text.Last() != '"' ) || (text.length() <= 1) )
|
|
|
|
text += wxT( "\"" );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
string = text;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
bool EDA_DirectorySelector( const wxString& Title,
|
|
|
|
wxString& Path,
|
|
|
|
int flag,
|
|
|
|
wxWindow* Frame,
|
2007-08-18 11:43:59 +00:00
|
|
|
const wxPoint& Pos )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-18 11:43:59 +00:00
|
|
|
int ii;
|
2011-11-08 16:37:25 +00:00
|
|
|
bool selected = false;
|
2007-08-18 11:43:59 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
wxDirDialog* DirFrame = new wxDirDialog( Frame,
|
|
|
|
wxString( Title ),
|
|
|
|
Path,
|
|
|
|
flag,
|
|
|
|
Pos );
|
2007-08-18 11:43:59 +00:00
|
|
|
|
|
|
|
ii = DirFrame->ShowModal();
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( ii == wxID_OK )
|
|
|
|
{
|
|
|
|
Path = DirFrame->GetPath();
|
2011-11-08 16:37:25 +00:00
|
|
|
selected = true;
|
2007-08-18 11:43:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DirFrame->Destroy();
|
|
|
|
return selected;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
wxString EDA_FileSelector( const wxString& Title,
|
|
|
|
const wxString& Path,
|
|
|
|
const wxString& FileName,
|
|
|
|
const wxString& Ext,
|
|
|
|
const wxString& Mask,
|
|
|
|
wxWindow* Frame,
|
|
|
|
int flag,
|
|
|
|
const bool keep_working_directory,
|
2007-08-18 11:43:59 +00:00
|
|
|
const wxPoint& Pos )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-18 11:43:59 +00:00
|
|
|
wxString fullfilename;
|
|
|
|
wxString curr_cwd = wxGetCwd();
|
|
|
|
wxString defaultname = FileName;
|
|
|
|
wxString defaultpath = Path;
|
2009-06-19 20:13:22 +00:00
|
|
|
wxString dotted_Ext = wxT(".") + Ext;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-10-18 19:31:40 +00:00
|
|
|
#ifdef __WINDOWS__
|
|
|
|
defaultname.Replace( wxT( "/" ), wxT( "\\" ) );
|
|
|
|
defaultpath.Replace( wxT( "/" ), wxT( "\\" ) );
|
|
|
|
#endif
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( defaultpath.IsEmpty() )
|
|
|
|
defaultpath = wxGetCwd();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-05-28 18:09:49 +00:00
|
|
|
wxSetWorkingDirectory( defaultpath );
|
|
|
|
|
2008-03-30 15:12:08 +00:00
|
|
|
#if 0 && defined (DEBUG)
|
2009-11-23 15:16:50 +00:00
|
|
|
printf( "defaultpath=\"%s\" defaultname=\"%s\" Ext=\"%s\" Mask=\"%s\" flag=%d keep_working_directory=%d\n",
|
2011-02-28 18:36:19 +00:00
|
|
|
TO_UTF8( defaultpath ),
|
|
|
|
TO_UTF8( defaultname ),
|
|
|
|
TO_UTF8( Ext ),
|
|
|
|
TO_UTF8( Mask ),
|
2009-11-23 15:16:50 +00:00
|
|
|
flag,
|
|
|
|
keep_working_directory );
|
2008-02-20 19:12:36 +00:00
|
|
|
#endif
|
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
fullfilename = wxFileSelector( wxString( Title ),
|
2008-12-08 15:27:13 +00:00
|
|
|
defaultpath,
|
|
|
|
defaultname,
|
2009-06-19 20:13:22 +00:00
|
|
|
dotted_Ext,
|
2008-12-08 15:27:13 +00:00
|
|
|
Mask,
|
|
|
|
flag, /* open mode wxFD_OPEN, wxFD_SAVE .. */
|
|
|
|
Frame,
|
|
|
|
Pos.x, Pos.y );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( keep_working_directory )
|
|
|
|
wxSetWorkingDirectory( curr_cwd );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
return fullfilename;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
wxString FindKicadHelpPath()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-18 11:43:59 +00:00
|
|
|
wxString FullPath, LangFullPath, tmp;
|
|
|
|
wxString LocaleString;
|
2011-11-08 16:37:25 +00:00
|
|
|
bool PathFound = false;
|
2008-03-30 15:12:08 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
/* find kicad/help/ */
|
2011-12-16 20:12:49 +00:00
|
|
|
tmp = wxGetApp().GetExecutablePath();
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( tmp.Last() == '/' )
|
|
|
|
tmp.RemoveLast();
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2008-03-06 19:57:06 +00:00
|
|
|
FullPath = tmp.BeforeLast( '/' ); // cd ..
|
2008-06-11 10:33:13 +00:00
|
|
|
FullPath += wxT( "/doc/help/" );
|
2011-12-16 20:12:49 +00:00
|
|
|
LocaleString = wxGetApp().GetLocale()->GetCanonicalName();
|
2008-03-30 15:12:08 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
wxString path_tmp = FullPath;
|
2007-07-09 09:29:53 +00:00
|
|
|
#ifdef __WINDOWS__
|
2007-08-18 11:43:59 +00:00
|
|
|
path_tmp.MakeLower();
|
2007-07-09 09:29:53 +00:00
|
|
|
#endif
|
2007-08-18 11:43:59 +00:00
|
|
|
if( path_tmp.Contains( wxT( "kicad" ) ) )
|
|
|
|
{
|
|
|
|
if( wxDirExists( FullPath ) )
|
2011-11-08 16:37:25 +00:00
|
|
|
PathFound = true;
|
2007-08-18 11:43:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* find kicad/help/ from environment variable KICAD */
|
2011-12-16 20:12:49 +00:00
|
|
|
if( !PathFound && wxGetApp().IsKicadEnvVariableDefined() )
|
2007-08-18 11:43:59 +00:00
|
|
|
{
|
2011-12-16 20:12:49 +00:00
|
|
|
FullPath = wxGetApp().GetKicadEnvVariable() + wxT( "/doc/help/" );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( wxDirExists( FullPath ) )
|
2011-11-08 16:37:25 +00:00
|
|
|
PathFound = true;
|
2007-08-18 11:43:59 +00:00
|
|
|
}
|
|
|
|
|
2008-03-06 19:57:06 +00:00
|
|
|
/* find kicad/help/ from "s_HelpPathList" */
|
2007-08-18 11:43:59 +00:00
|
|
|
int ii = 0;
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
while( !PathFound )
|
|
|
|
{
|
|
|
|
FullPath = s_HelpPathList[ii++];
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( FullPath == wxT( "end_list" ) )
|
|
|
|
break;
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( wxDirExists( FullPath ) )
|
2011-11-08 16:37:25 +00:00
|
|
|
PathFound = true;
|
2007-08-18 11:43:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( PathFound )
|
|
|
|
{
|
|
|
|
LangFullPath = FullPath + LocaleString + UNIX_STRING_DIR_SEP;
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( wxDirExists( LangFullPath ) )
|
|
|
|
return LangFullPath;
|
|
|
|
|
|
|
|
LangFullPath = FullPath + LocaleString.Left( 2 ) + UNIX_STRING_DIR_SEP;
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( wxDirExists( LangFullPath ) )
|
|
|
|
return LangFullPath;
|
|
|
|
|
|
|
|
LangFullPath = FullPath + wxT( "en/" );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( wxDirExists( LangFullPath ) )
|
2011-11-08 16:37:25 +00:00
|
|
|
{
|
2007-08-18 11:43:59 +00:00
|
|
|
return LangFullPath;
|
2011-11-08 16:37:25 +00:00
|
|
|
}
|
2007-08-18 11:43:59 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
LangFullPath = FullPath + wxT( "fr/" );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( wxDirExists( LangFullPath ) )
|
|
|
|
return LangFullPath;
|
|
|
|
}
|
|
|
|
return FullPath;
|
|
|
|
}
|
|
|
|
return wxEmptyString;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
wxString FindKicadFile( const wxString& shortname )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-18 11:43:59 +00:00
|
|
|
wxString FullFileName;
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/* Test the presence of the file in the directory shortname of
|
2011-09-30 18:15:37 +00:00
|
|
|
* the KiCad binary path.
|
2009-11-23 15:16:50 +00:00
|
|
|
*/
|
2011-12-16 20:12:49 +00:00
|
|
|
FullFileName = wxGetApp().GetExecutablePath() + shortname;
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( wxFileExists( FullFileName ) )
|
|
|
|
return FullFileName;
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/* Test the presence of the file in the directory shortname
|
2011-11-08 16:37:25 +00:00
|
|
|
* defined by the environment variable KiCad.
|
2009-11-23 15:16:50 +00:00
|
|
|
*/
|
2011-12-16 20:12:49 +00:00
|
|
|
if( wxGetApp().IsKicadEnvVariableDefined() )
|
2007-08-18 11:43:59 +00:00
|
|
|
{
|
2011-12-16 20:12:49 +00:00
|
|
|
FullFileName = wxGetApp().GetKicadEnvVariable() + shortname;
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( wxFileExists( FullFileName ) )
|
|
|
|
return FullFileName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* find binary file from default path list:
|
|
|
|
* /usr/local/kicad/linux or c:/kicad/winexe
|
|
|
|
* (see s_KicadDataPathList) */
|
|
|
|
int ii = 0;
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
while( 1 )
|
|
|
|
{
|
|
|
|
if( s_KicadBinaryPathList[ii] == wxT( "end_list" ) )
|
|
|
|
break;
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
FullFileName = s_KicadBinaryPathList[ii++] + shortname;
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( wxFileExists( FullFileName ) )
|
|
|
|
return FullFileName;
|
|
|
|
}
|
|
|
|
|
|
|
|
return shortname;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
|
2013-01-18 10:42:23 +00:00
|
|
|
int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& param,
|
|
|
|
wxProcess *callback )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-18 11:43:59 +00:00
|
|
|
wxString FullFileName;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
FullFileName = FindKicadFile( ExecFile );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-26 19:48:45 +00:00
|
|
|
#ifdef __WXMAC__
|
2012-10-18 19:31:40 +00:00
|
|
|
if( wxFileExists( FullFileName ) || wxDir::Exists( FullFileName ) )
|
2012-01-26 19:48:45 +00:00
|
|
|
{
|
2013-01-18 10:42:23 +00:00
|
|
|
return ProcessExecute( wxGetApp().GetExecutablePath() + wxT( "/" )
|
|
|
|
+ ExecFile + wxT( " " )
|
|
|
|
+ param, wxEXEC_ASYNC, callback );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return ProcessExecute( wxT( "/usr/bin/open " ) + param, wxEXEC_ASYNC, callback );
|
2012-01-26 19:48:45 +00:00
|
|
|
}
|
|
|
|
#else
|
2007-08-18 11:43:59 +00:00
|
|
|
if( wxFileExists( FullFileName ) )
|
|
|
|
{
|
|
|
|
if( !param.IsEmpty() )
|
|
|
|
FullFileName += wxT( " " ) + param;
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2013-01-18 10:42:23 +00:00
|
|
|
return ProcessExecute( FullFileName, wxEXEC_ASYNC, callback );
|
2007-08-18 11:43:59 +00:00
|
|
|
}
|
2012-01-26 19:48:45 +00:00
|
|
|
#endif
|
2007-08-18 11:43:59 +00:00
|
|
|
wxString msg;
|
2010-07-11 16:24:44 +00:00
|
|
|
msg.Printf( _( "Command <%s> could not found" ), GetChars( FullFileName ) );
|
2007-08-18 11:43:59 +00:00
|
|
|
DisplayError( frame, msg, 20 );
|
|
|
|
return -1;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
wxString ReturnKicadDatasPath()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-11-08 16:37:25 +00:00
|
|
|
bool PathFound = false;
|
2007-08-18 11:43:59 +00:00
|
|
|
wxString data_path;
|
|
|
|
|
2011-12-16 20:12:49 +00:00
|
|
|
if( wxGetApp().IsKicadEnvVariableDefined() ) // Path defined by the KICAD environment variable.
|
2007-08-18 11:43:59 +00:00
|
|
|
{
|
2011-12-16 20:12:49 +00:00
|
|
|
data_path = wxGetApp().GetKicadEnvVariable();
|
2011-11-08 16:37:25 +00:00
|
|
|
PathFound = true;
|
2007-08-18 11:43:59 +00:00
|
|
|
}
|
2009-11-23 15:16:50 +00:00
|
|
|
else // Path of executables.
|
2007-08-18 11:43:59 +00:00
|
|
|
{
|
2011-12-16 20:12:49 +00:00
|
|
|
wxString tmp = wxGetApp().GetExecutablePath();
|
2007-07-09 09:29:53 +00:00
|
|
|
#ifdef __WINDOWS__
|
2007-08-18 11:43:59 +00:00
|
|
|
tmp.MakeLower();
|
2007-07-09 09:29:53 +00:00
|
|
|
#endif
|
2007-08-18 11:43:59 +00:00
|
|
|
if( tmp.Contains( wxT( "kicad" ) ) )
|
|
|
|
{
|
2007-07-09 09:29:53 +00:00
|
|
|
#ifdef __WINDOWS__
|
2011-12-16 20:12:49 +00:00
|
|
|
tmp = wxGetApp().GetExecutablePath();
|
2007-07-09 09:29:53 +00:00
|
|
|
#endif
|
2007-08-18 11:43:59 +00:00
|
|
|
if( tmp.Last() == '/' )
|
|
|
|
tmp.RemoveLast();
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
data_path = tmp.BeforeLast( '/' ); // id cd ../
|
|
|
|
data_path += UNIX_STRING_DIR_SEP;
|
2008-12-08 15:27:13 +00:00
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
// Old versions of KiCad use kicad/ as default for data
|
2008-06-22 08:54:05 +00:00
|
|
|
// and last versions kicad/share/
|
|
|
|
// So we search for kicad/share/ first
|
|
|
|
wxString old_path = data_path;
|
2008-12-08 15:27:13 +00:00
|
|
|
data_path += wxT( "share/" );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( wxDirExists( data_path ) )
|
2011-11-08 16:37:25 +00:00
|
|
|
{
|
|
|
|
PathFound = true;
|
|
|
|
}
|
2008-12-08 15:27:13 +00:00
|
|
|
else if( wxDirExists( old_path ) )
|
2008-06-22 08:54:05 +00:00
|
|
|
{
|
|
|
|
data_path = old_path;
|
2011-11-08 16:37:25 +00:00
|
|
|
PathFound = true;
|
2008-06-22 08:54:05 +00:00
|
|
|
}
|
2007-08-18 11:43:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/* find KiCad from default path list:
|
2007-08-18 11:43:59 +00:00
|
|
|
* /usr/local/kicad/ or c:/kicad/
|
|
|
|
* (see s_KicadDataPathList) */
|
|
|
|
int ii = 0;
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
while( !PathFound )
|
|
|
|
{
|
|
|
|
if( s_KicadDataPathList[ii] == wxT( "end_list" ) )
|
|
|
|
break;
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
data_path = s_KicadDataPathList[ii++];
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( wxDirExists( data_path ) )
|
2011-11-08 16:37:25 +00:00
|
|
|
PathFound = true;
|
2007-08-18 11:43:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( PathFound )
|
|
|
|
{
|
|
|
|
data_path.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
2011-09-06 14:09:40 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( data_path.Last() != '/' )
|
|
|
|
data_path += UNIX_STRING_DIR_SEP;
|
|
|
|
}
|
|
|
|
else
|
2011-09-06 14:09:40 +00:00
|
|
|
{
|
2007-08-18 11:43:59 +00:00
|
|
|
data_path.Empty();
|
2011-09-06 14:09:40 +00:00
|
|
|
}
|
2007-08-18 11:43:59 +00:00
|
|
|
|
|
|
|
return data_path;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-06 14:09:40 +00:00
|
|
|
wxString& EDA_APP::GetEditorName()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
wxString editorname = m_EditorName;
|
2007-08-18 11:43:59 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
// We get the preferred editor name from environment variable first.
|
2009-04-05 20:49:15 +00:00
|
|
|
if( editorname.IsEmpty() )
|
2007-08-18 11:43:59 +00:00
|
|
|
{
|
2012-01-23 04:33:36 +00:00
|
|
|
// If there is no EDITOR variable set, try the desktop default
|
2011-05-12 18:47:56 +00:00
|
|
|
if(!wxGetEnv( wxT( "EDITOR" ), &editorname ))
|
|
|
|
{
|
2012-01-26 19:48:45 +00:00
|
|
|
#ifdef __WXMAC__
|
2011-05-12 18:47:56 +00:00
|
|
|
editorname = "/usr/bin/open";
|
|
|
|
#elif __WXX11__
|
|
|
|
editorname = "/usr/bin/xdg-open";
|
|
|
|
#endif
|
|
|
|
}
|
2007-08-18 11:43:59 +00:00
|
|
|
}
|
2009-11-23 15:16:50 +00:00
|
|
|
if( editorname.IsEmpty() ) // We must get a preferred editor name
|
2007-08-18 11:43:59 +00:00
|
|
|
{
|
2009-11-23 15:16:50 +00:00
|
|
|
DisplayInfoMessage( NULL,
|
|
|
|
_( "No default editor found, you must choose it" ) );
|
2007-08-18 11:43:59 +00:00
|
|
|
wxString mask( wxT( "*" ) );
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#ifdef __WINDOWS__
|
2007-08-18 11:43:59 +00:00
|
|
|
mask += wxT( ".exe" );
|
2007-05-06 16:03:28 +00:00
|
|
|
#endif
|
2009-11-23 15:16:50 +00:00
|
|
|
editorname = EDA_FileSelector( _( "Preferred Editor:" ), wxEmptyString,
|
2009-04-05 20:49:15 +00:00
|
|
|
wxEmptyString, wxEmptyString, mask,
|
|
|
|
NULL, wxFD_OPEN, true );
|
2007-08-18 11:43:59 +00:00
|
|
|
}
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
if( !editorname.IsEmpty() )
|
2007-08-18 11:43:59 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
m_EditorName = editorname;
|
2011-12-16 20:12:49 +00:00
|
|
|
m_commonSettings->Write( wxT( "Editor" ), m_EditorName );
|
2007-08-18 11:43:59 +00:00
|
|
|
}
|
2009-04-05 20:49:15 +00:00
|
|
|
|
|
|
|
return m_EditorName;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
bool OpenPDF( const wxString& file )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2007-08-18 11:43:59 +00:00
|
|
|
wxString command;
|
|
|
|
wxString filename = file;
|
|
|
|
wxString type;
|
2008-12-08 15:27:13 +00:00
|
|
|
bool success = false;
|
2007-08-18 11:43:59 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
wxGetApp().ReadPdfBrowserInfos();
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2011-12-16 20:12:49 +00:00
|
|
|
if( !wxGetApp().UseSystemPdfBrowser() ) // Run the preferred PDF Browser
|
2007-08-18 11:43:59 +00:00
|
|
|
{
|
|
|
|
AddDelimiterString( filename );
|
2011-12-16 20:12:49 +00:00
|
|
|
command = wxGetApp().GetPdfBrowserFileName() + wxT( " " ) + filename;
|
2007-08-18 11:43:59 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wxFileType* filetype = NULL;
|
|
|
|
wxFileType::MessageParameters params( filename, type );
|
2008-06-29 18:51:38 +00:00
|
|
|
filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( wxT( "pdf" ) );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( filetype )
|
|
|
|
success = filetype->GetOpenCommand( &command, params );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
delete filetype;
|
2011-12-16 20:12:49 +00:00
|
|
|
|
2008-06-29 18:51:38 +00:00
|
|
|
#ifndef __WINDOWS__
|
2008-12-08 15:27:13 +00:00
|
|
|
|
2011-12-16 20:12:49 +00:00
|
|
|
// Bug ? under linux wxWidgets returns acroread as PDF viewer, even if
|
2009-11-23 15:16:50 +00:00
|
|
|
// it does not exist.
|
2008-12-08 15:27:13 +00:00
|
|
|
if( command.StartsWith( wxT( "acroread" ) ) ) // Workaround
|
2008-06-29 18:51:38 +00:00
|
|
|
success = false;
|
|
|
|
#endif
|
2011-12-16 20:12:49 +00:00
|
|
|
|
2008-06-29 18:51:38 +00:00
|
|
|
if( success && !command.IsEmpty() )
|
|
|
|
{
|
|
|
|
success = ProcessExecute( command );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
if( success )
|
2008-07-08 18:45:06 +00:00
|
|
|
return success;
|
2008-06-29 18:51:38 +00:00
|
|
|
}
|
2008-07-08 18:45:06 +00:00
|
|
|
|
|
|
|
success = false;
|
|
|
|
command.Empty();
|
2007-08-18 11:43:59 +00:00
|
|
|
|
|
|
|
if( !success )
|
|
|
|
{
|
2008-06-29 18:51:38 +00:00
|
|
|
#ifndef __WINDOWS__
|
|
|
|
AddDelimiterString( filename );
|
2011-12-16 20:12:49 +00:00
|
|
|
|
2008-06-29 18:51:38 +00:00
|
|
|
/* here is a list of PDF viewers candidates */
|
2008-01-01 07:51:54 +00:00
|
|
|
const static wxString tries[] =
|
2007-08-18 11:43:59 +00:00
|
|
|
{
|
|
|
|
wxT( "/usr/bin/evince" ),
|
|
|
|
wxT( "/usr/bin/gpdf" ),
|
2008-06-29 18:51:38 +00:00
|
|
|
wxT( "/usr/bin/konqueror" ),
|
|
|
|
wxT( "/usr/bin/kpdf" ),
|
|
|
|
wxT( "/usr/bin/xpdf" ),
|
2011-05-12 18:47:56 +00:00
|
|
|
wxT( "/usr/bin/open" ), // BSD and OSX file & dir opener
|
|
|
|
wxT( "/usr/bin/xdg-open" ), // Freedesktop file & dir opener
|
2007-08-18 11:43:59 +00:00
|
|
|
wxT( "" ),
|
|
|
|
};
|
2008-02-20 19:12:36 +00:00
|
|
|
|
2008-06-29 18:51:38 +00:00
|
|
|
for( int ii = 0; ; ii++ )
|
2007-08-18 11:43:59 +00:00
|
|
|
{
|
2008-06-29 18:51:38 +00:00
|
|
|
if( tries[ii].IsEmpty() )
|
2007-08-18 11:43:59 +00:00
|
|
|
break;
|
2008-02-20 19:12:36 +00:00
|
|
|
|
2008-06-29 18:51:38 +00:00
|
|
|
if( wxFileExists( tries[ii] ) )
|
2007-08-18 11:43:59 +00:00
|
|
|
{
|
2008-06-29 18:51:38 +00:00
|
|
|
command = tries[ii] + wxT( " " ) + filename;
|
|
|
|
break;
|
2007-08-18 11:43:59 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-08 15:27:13 +00:00
|
|
|
|
2008-06-29 18:51:38 +00:00
|
|
|
#endif
|
2007-08-18 11:43:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !command.IsEmpty() )
|
2008-06-29 18:51:38 +00:00
|
|
|
{
|
|
|
|
success = ProcessExecute( command );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
if( !success )
|
2008-06-29 18:51:38 +00:00
|
|
|
{
|
2013-04-09 17:49:01 +00:00
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Problem while running the PDF viewer\nCommand is '%s'" ),
|
|
|
|
GetChars( command ) );
|
2008-06-29 18:51:38 +00:00
|
|
|
DisplayError( NULL, msg );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-09 17:49:01 +00:00
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Unable to find a PDF viewer for <%s>" ), GetChars( filename ) );
|
2008-06-29 18:51:38 +00:00
|
|
|
DisplayError( NULL, msg );
|
|
|
|
success = false;
|
|
|
|
}
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2008-06-29 18:51:38 +00:00
|
|
|
return success;
|
|
|
|
}
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
void OpenFile( const wxString& file )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2007-08-18 11:43:59 +00:00
|
|
|
wxString command;
|
|
|
|
wxString filename = file;
|
|
|
|
|
|
|
|
wxFileName CurrentFileName( filename );
|
|
|
|
wxString ext, type;
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
ext = CurrentFileName.GetExt();
|
2011-11-08 16:37:25 +00:00
|
|
|
wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( ext );
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
bool success = false;
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
wxFileType::MessageParameters params( filename, type );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( filetype )
|
|
|
|
success = filetype->GetOpenCommand( &command, params );
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
delete filetype;
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2007-08-18 11:43:59 +00:00
|
|
|
if( success && !command.IsEmpty() )
|
2008-04-24 16:55:35 +00:00
|
|
|
ProcessExecute( command );
|
2007-05-28 18:09:49 +00:00
|
|
|
}
|
2009-04-05 20:49:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
wxString QuoteFullPath( wxFileName& fn, wxPathFormat format )
|
|
|
|
{
|
2010-05-11 14:35:13 +00:00
|
|
|
return wxT( "\"" ) + fn.GetFullPath( format ) + wxT( "\"" );
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|