Add Sys_OpenFolderInFileManager
This commit is contained in:
1 parent
5c242be241
commit
411f5a6924
5 files changed
+49
-1
No files matched your search
@@ -68,6 +68,8 @@ void Sys_AnsiColorPrint( const char *msg );
|
||||
int Sys_PID( void );
|
||||
qboolean Sys_PIDIsRunning( int pid );
|
||||
|
||||
qboolean Sys_OpenFolderInPlatformFileManager( const char *path );
|
||||
|
||||
#ifdef PROTOCOL_HANDLER
|
||||
char *Sys_ParseProtocolUri( const char *uri );
|
||||
#endif
|
||||
+16
-1
@@ -277,6 +277,22 @@ void Sys_InitPIDFile( const char *gamedir ) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Sys_OpenFolderInFileManager
|
||||
=================
|
||||
*/
|
||||
qboolean Sys_OpenFolderInFileManager( const char *path, qboolean create )
|
||||
{
|
||||
if( create )
|
||||
{
|
||||
if( FS_CreatePath( path ) )
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
return Sys_OpenFolderInPlatformFileManager( path );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Sys_Exit
|
||||
@@ -880,4 +896,3 @@ int main( int argc, char **argv )
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1016,3 +1016,23 @@ qboolean Sys_DllExtension( const char *name ) {
|
||||
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
Sys_OpenFolderInPlatformFileManager
|
||||
==============
|
||||
*/
|
||||
qboolean Sys_OpenFolderInPlatformFileManager( const char *path )
|
||||
{
|
||||
Sys_ClearExecBuffer( );
|
||||
|
||||
#ifdef __APPLE__
|
||||
Sys_AppendToExecBuffer( "open" );
|
||||
#else
|
||||
Sys_AppendToExecBuffer( "xdg-open" );
|
||||
#endif
|
||||
|
||||
Sys_AppendToExecBuffer( path );
|
||||
|
||||
return Sys_Exec( ) == 0;
|
||||
}
|
||||
@@ -915,3 +915,13 @@ Check if filename should be allowed to be loaded as a DLL.
|
||||
qboolean Sys_DllExtension( const char *name ) {
|
||||
return COM_CompareExtension( name, DLL_EXT );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
Sys_OpenFolderInPlatformFileManager
|
||||
==============
|
||||
*/
|
||||
qboolean Sys_OpenFolderInPlatformFileManager( const char *path )
|
||||
{
|
||||
return ShellExecute( NULL, "explore", path, NULL, NULL, SW_SHOWDEFAULT ) > (HINSTANCE)32;
|
||||
}
|
||||
Reference in new issue
Block a user