mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-21 23:40:26 -04:00
Created V0.3.x branch and moved the head into the trunk directory.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@246 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
commit
935745a08e
1318 changed files with 348809 additions and 0 deletions
82
retroshare-gui/src/util/win32.cpp
Normal file
82
retroshare-gui/src/util/win32.cpp
Normal file
|
@ -0,0 +1,82 @@
|
|||
/****************************************************************
|
||||
* RShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006, crypton
|
||||
*
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#if 0
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
#endif
|
||||
|
||||
#include <QDir>
|
||||
#include "win32.h"
|
||||
|
||||
|
||||
/** Finds the location of the "special" Windows folder using the given CSIDL
|
||||
* value. If the folder cannot be found, the given default path is used. */
|
||||
QString
|
||||
win32_get_folder_location(int folder, QString defaultPath)
|
||||
{
|
||||
#if 0
|
||||
TCHAR path[MAX_PATH+1];
|
||||
LPITEMIDLIST idl;
|
||||
IMalloc *m;
|
||||
HRESULT result;
|
||||
|
||||
/* Find the location of %PROGRAMFILES% */
|
||||
if (SUCCEEDED(SHGetSpecialFolderLocation(NULL, folder, &idl))) {
|
||||
/* Get the path from the IDL */
|
||||
result = SHGetPathFromIDList(idl, path);
|
||||
SHGetMalloc(&m);
|
||||
if (m) {
|
||||
m->Release();
|
||||
}
|
||||
if (SUCCEEDED(result)) {
|
||||
QT_WA(return QString::fromUtf16((const ushort *)path);,
|
||||
return QString::fromLocal8Bit((char *)path);)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return defaultPath;
|
||||
}
|
||||
|
||||
/** Gets the location of the user's %PROGRAMFILES% folder. */
|
||||
QString
|
||||
win32_program_files_folder()
|
||||
{
|
||||
return win32_get_folder_location(
|
||||
#if 0
|
||||
CSIDL_PROGRAM_FILES, QDir::rootPath() + "\\Program Files");
|
||||
#endif
|
||||
0, QDir::rootPath() + "\\Program Files");
|
||||
}
|
||||
|
||||
/** Gets the location of the user's %APPDATA% folder. */
|
||||
QString
|
||||
win32_app_data_folder()
|
||||
{
|
||||
return win32_get_folder_location(
|
||||
#if 0
|
||||
CSIDL_APPDATA, QDir::homePath() + "\\Application Data");
|
||||
#endif
|
||||
0, QDir::homePath() + "\\Application Data");
|
||||
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue