本文整理汇总了C++中FSFindFolder函数的典型用法代码示例。如果您正苦于以下问题:C++ FSFindFolder函数的具体用法?C++ FSFindFolder怎么用?C++ FSFindFolder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FSFindFolder函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: strdup
char *Bgethomedir(void)
{
#ifdef _WIN32
TCHAR appdata[MAX_PATH];
if (SUCCEEDED(SHGetSpecialFolderPathA(NULL, appdata, CSIDL_APPDATA, FALSE)))
return strdup(appdata);
return NULL;
#elif defined __APPLE__
FSRef ref;
CFStringRef str;
CFURLRef base;
char *s;
if (FSFindFolder(kUserDomain, kVolumeRootFolderType, kDontCreateFolder, &ref) < 0) return NULL;
base = CFURLCreateFromFSRef(NULL, &ref);
if (!base) return NULL;
str = CFURLCopyFileSystemPath(base, kCFURLPOSIXPathStyle);
CFRelease(base);
if (!str) return NULL;
s = (char*)CFStringGetCStringPtr(str,CFStringGetSystemEncoding());
if (s) s = strdup(s);
CFRelease(str);
return s;
#else
char *e = getenv("HOME");
if (!e) return NULL;
return strdup(e);
#endif
}
开发者ID:Plagman,项目名称:jfbuild,代码行数:30,代码来源:compat.c
示例2: FSFindFolder
QString QDesktopServices::storageLocation(StandardLocation type)
{
if (type == HomeLocation)
return QDir::homePath();
if (type == TempLocation)
return QDir::tempPath();
short domain = kOnAppropriateDisk;
if (type == DataLocation || type == CacheLocation)
domain = kUserDomain;
// http://developer.apple.com/documentation/Carbon/Reference/Folder_Manager/Reference/reference.html
FSRef ref;
OSErr err = FSFindFolder(domain, translateLocation(type), false, &ref);
if (err)
return QString();
QString path = getFullPath(ref);
if (type == DataLocation || type == CacheLocation) {
if (QCoreApplication::organizationName().isEmpty() == false)
path += QLatin1Char('/') + QCoreApplication::organizationName();
if (QCoreApplication::applicationName().isEmpty() == false)
path += QLatin1Char('/') + QCoreApplication::applicationName();
}
return path;
}
开发者ID:wpbest,项目名称:copperspice,代码行数:30,代码来源:qdesktopservices_mac.cpp
示例3: ProfileOperaPrepare
void ProfileOperaPrepare() // PROFILE_OPERA_PREPARE()
{
FSRef ref;
char path[MAX_PATH];
const char* klient_path = "/klient/opera_profile.txt";
FSFindFolder( kUserDomain, kApplicationSupportFolderType, kDontCreateFolder, &ref );
FSRefMakePath( &ref, (UInt8*)&path, MAX_PATH);
char tmppath[MAX_PATH];
if (!CFStringGetCString(CFBundleGetIdentifier(CFBundleGetMainBundle()), tmppath, MAX_PATH, kCFStringEncodingUTF8)) {
OP_ASSERT(!"Error copying bundleid to string");
return;
}
if (op_strlen(path) + op_strlen(tmppath) + op_strlen(klient_path) + 1 >= MAX_PATH) {
OP_ASSERT(!"profile storage path too long");
return;
}
op_strcat(path, "/");
op_strcat(path, tmppath);
op_strcat(path, klient_path);
s_profile_opera_file = fopen(path,"w+");
}
开发者ID:prestocore,项目名称:browser,代码行数:26,代码来源:mac_profile.cpp
示例4: getTempDirectory
bfs::path
getTempDirectory()
{
bfs::path tempDir;
FSRef fref;
OSErr err = FSFindFolder(kUserDomain, kTemporaryFolderType,
kCreateFolder, &fref);
if (err == noErr) {
CFURLRef tmpUrl = CFURLCreateFromFSRef(kCFAllocatorSystemDefault,
&fref);
if (tmpUrl != NULL) {
CFStringRef ctmpDir = CFURLCopyFileSystemPath(tmpUrl,
kCFURLPOSIXPathStyle);
tempDir = stringRefToUTF8(ctmpDir);
CFRelease(ctmpDir);
CFRelease(tmpUrl);
} else {
boost::system::error_code ec(errno, boost::system::system_category());
throw bfs::filesystem_error("Can't get temp dir", bfs::path(),
bfs::path(), ec);
}
}
tempDir /= "YahooBrowserPlus";
boost::filesystem::create_directories(tempDir);
return tempDir;
}
开发者ID:Go-LiDth,项目名称:platform,代码行数:27,代码来源:bpfile_UNIX.cpp
示例5: GetFullPathToDesktop
int32 GetFullPathToDesktop(char * fullPath, int32 maxPathLength)
{
int32 error = 0;
if (fullPath == NULL) return kSPBadParameterError;
#if __PIMac__
FSRef fsRef;
error = FSFindFolder(kOnSystemDisk,
kDesktopFolderType,
kDontCreateFolder,
&fsRef);
if (error) return error;
error = FSRefMakePath(&fsRef, (unsigned char*)fullPath, maxPathLength);
strcat(fullPath, "/");
#else
HRESULT hr = SHGetFolderPath( NULL, CSIDL_DESKTOPDIRECTORY, NULL, 0, fullPath );
if (FAILED(hr))
{
strcpy(fullPath, "C:\\");
}
else
{
strcat(fullPath, "\\");
}
#endif
return error;
}
开发者ID:jxfengzi,项目名称:AirPhoto,代码行数:35,代码来源:PIUFile.cpp
示例6: SHGetSpecialFolderLocation
AnsiString PathUtil::GetUserDirectory() {
AnsiString userDir = "./";
#ifdef __WIN32__
char buffer[MAX_PATH];
buffer[0] = '\0';
LPITEMIDLIST pidl = NULL;
LPMALLOC pMalloc;
if (SUCCEEDED(SHGetMalloc(&pMalloc))) {
SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl);
if (pidl) {
SHGetPathFromIDList(pidl, buffer);
}
pMalloc->Free(pidl);
userDir = AnsiString(buffer);
}
#elif __MACOSX__
FSRef fileRef;
OSStatus error = FSFindFolder(kUserDomain, kApplicationSupportFolderType, true, &fileRef);
if (error == noErr) {
char buffer[MAX_PATH];
error = FSRefMakePath(&fileRef, (UInt8 *)buffer, sizeof(buffer));
if (error == noErr)
userDir = buffer;
}
#elif __IPHONEOS__
char path[MAX_PATH];
IOS_GetDataDir(path);
userDir = AnsiString(path);
#endif
return userDir;
}
开发者ID:somaen,项目名称:Wintermute-git,代码行数:34,代码来源:PathUtil.cpp
示例7: Bgethomedir
char *Bgetsupportdir(int global)
{
#ifndef __APPLE__
return Bgethomedir();
#else
#if LOWANG_IOS
return Bgethomedir();
#else
FSRef ref;
CFStringRef str;
CFURLRef base;
char *s;
if (FSFindFolder(global ? kLocalDomain : kUserDomain,
kApplicationSupportFolderType,
kDontCreateFolder, &ref) < 0) return NULL;
base = CFURLCreateFromFSRef(NULL, &ref);
if (!base) return NULL;
str = CFURLCopyFileSystemPath(base, kCFURLPOSIXPathStyle);
CFRelease(base);
if (!str) return NULL;
s = (char*)CFStringGetCStringPtr(str,CFStringGetSystemEncoding());
if (s) s = strdup(s);
CFRelease(str);
return s;
#endif
#endif
}
开发者ID:TermiT,项目名称:Shadow-Warrior-iOS,代码行数:28,代码来源:compat.c
示例8: CreateStandardAutoExec
void FGameConfigFile::CreateStandardAutoExec(const char *section, bool start)
{
if (!SetSection(section))
{
FString path;
#ifdef __APPLE__
char cpath[PATH_MAX];
FSRef folder;
if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) &&
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
{
path << cpath << "/" GAME_DIR "/autoexec.cfg";
}
#elif !defined(unix)
path = "$PROGDIR/autoexec.cfg";
#else
path = GetUserFile ("autoexec.cfg");
#endif
SetSection (section, true);
SetValueForKey ("Path", path.GetChars());
}
if (start)
{
MoveSectionToStart(section);
}
}
开发者ID:Xeomuz,项目名称:Doom-Port-Source-Code,代码行数:27,代码来源:gameconfigfile.cpp
示例9: LoadFrameworkBundle
OSStatus LoadFrameworkBundle(CFStringRef framework, CFBundleRef
*bundlePtr)
{
OSStatus err;
FSRef frameworksFolderRef;
CFURLRef baseURL;
CFURLRef bundleURL;
if ( bundlePtr == nil ) return( -1 );
*bundlePtr = nil;
baseURL = nil;
bundleURL = nil;
err = FSFindFolder(kOnAppropriateDisk, kFrameworksFolderType, true,
&frameworksFolderRef);
if (err == noErr) {
baseURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault,
&frameworksFolderRef);
if (baseURL == nil) {
err = coreFoundationUnknownErr;
}
}
if (err == noErr) {
bundleURL =
CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault, baseURL,
framework, false);
if (bundleURL == nil) {
err = coreFoundationUnknownErr;
}
}
if (err == noErr) {
*bundlePtr = CFBundleCreate(kCFAllocatorSystemDefault, bundleURL);
if (*bundlePtr == nil) {
err = coreFoundationUnknownErr;
}
}
if (err == noErr) {
if ( ! CFBundleLoadExecutable( *bundlePtr ) ) {
err = coreFoundationUnknownErr;
}
}
// Clean up.
if (err != noErr && *bundlePtr != nil) {
CFRelease(*bundlePtr);
*bundlePtr = nil;
}
if (bundleURL != nil) {
CFRelease(bundleURL);
}
if (baseURL != nil) {
CFRelease(baseURL);
}
return err;
}
开发者ID:Geal,项目名称:Squeak-VM,代码行数:59,代码来源:NPSqueakStub.c
示例10: PathForFolderType
static void PathForFolderType( char dir[PATH_MAX], OSType folderType )
{
FSRef fs;
if( FSFindFolder(kUserDomain, folderType, kDontCreateFolder, &fs) )
FAIL_M( ssprintf("FSFindFolder(%lu) failed.", folderType) );
if( FSRefMakePath(&fs, (UInt8 *)dir, PATH_MAX) )
FAIL_M( "FSRefMakePath() failed." );
}
开发者ID:Ancaro,项目名称:stepmania,代码行数:9,代码来源:ArchHooks_MacOSX.cpp
示例11: LoadFrameworkBundle
OSStatus LoadFrameworkBundle(SInt16 folderLocation,CFStringRef framework, CFBundleRef *bundlePtr)
{
OSStatus err;
FSRef frameworksFolderRef;
CFURLRef baseURL;
CFURLRef bundleURL;
*bundlePtr = nil;
baseURL = nil;
bundleURL = nil;
err = FSFindFolder(folderLocation, kFrameworksFolderType, true, &frameworksFolderRef);
if (err == noErr) {
baseURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault, &frameworksFolderRef);
if (baseURL == nil) {
err = coreFoundationUnknownErr;
}
}
if (err == noErr) {
bundleURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault, baseURL, framework, false);
if (bundleURL == nil) {
err = coreFoundationUnknownErr;
}
}
if (err == noErr) {
*bundlePtr = CFBundleCreate(kCFAllocatorSystemDefault, bundleURL);
if (*bundlePtr == nil) {
err = coreFoundationUnknownErr;
}
}
if (err == noErr) {
if ( ! CFBundleLoadExecutable( *bundlePtr ) ) {
err = coreFoundationUnknownErr;
}
}
// Clean up.
if (err != noErr && *bundlePtr != nil) {
CFRelease(*bundlePtr);
*bundlePtr = nil;
}
if (bundleURL != nil) {
CFRelease(bundleURL);
}
if (baseURL != nil) {
CFRelease(baseURL);
}
#ifdef JMMDEBUG
fprintf(stderr,"\nsystem location %i error %i",folderLocation,err);
#endif
return err;
}
开发者ID:fniephaus,项目名称:squeak,代码行数:56,代码来源:sqMacExternalPrims.c
示例12: CFQBundleCreateFromFrameworkName
extern pascal OSStatus CFQBundleCreateFromFrameworkName(CFStringRef frameworkName,
CFBundleRef *bundlePtr)
// See comment in header.
{
OSStatus err;
FSRef frameworksFolderRef;
CFURLRef baseURL;
CFURLRef bundleURL;
assert(frameworkName != NULL);
assert( bundlePtr != NULL);
assert(*bundlePtr == NULL);
*bundlePtr = NULL;
baseURL = NULL;
bundleURL = NULL;
// Find the frameworks folder and create a URL for it.
err = FSFindFolder(kOnAppropriateDisk, kFrameworksFolderType, true, &frameworksFolderRef);
if (err == noErr) {
baseURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault, &frameworksFolderRef);
err = CFQError(baseURL);
}
// Append the name of the framework to the URL.
if (err == noErr) {
bundleURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault, baseURL, frameworkName, false);
err = CFQError(bundleURL);
}
// Create a bundle based on that URL and load the bundle into memory.
if (err == noErr) {
*bundlePtr = CFBundleCreate(kCFAllocatorSystemDefault, bundleURL);
err = CFQError(*bundlePtr);
}
if (err == noErr) {
err = CFQErrorBoolean( CFBundleLoadExecutable( *bundlePtr ) );
}
// Clean up.
if (err != noErr) {
CFQRelease(*bundlePtr);
*bundlePtr = NULL;
}
CFQRelease(bundleURL);
CFQRelease(baseURL);
assert( (err == noErr) == (*bundlePtr != NULL) );
return err;
}
开发者ID:paullalonde,项目名称:B,代码行数:56,代码来源:MoreCFQ.c
示例13: RTDECL
RTDECL(int) RTPathUserDocuments(char *pszPath, size_t cchPath)
{
/*
* Validate input
*/
AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
AssertReturn(cchPath, VERR_INVALID_PARAMETER);
/*
* Try NSSystemDirectories first since that works for directories that doesn't exist.
*/
int rc = VERR_PATH_NOT_FOUND;
NSSearchPathEnumerationState EnmState = NSStartSearchPathEnumeration(NSDocumentDirectory, NSUserDomainMask);
if (EnmState != 0)
{
char szTmp[PATH_MAX];
szTmp[0] = szTmp[PATH_MAX - 1] = '\0';
EnmState = NSGetNextSearchPathEnumeration(EnmState, szTmp);
if (EnmState != 0)
{
size_t cchTmp = strlen(szTmp);
if (cchTmp >= cchPath)
return VERR_BUFFER_OVERFLOW;
if (szTmp[0] == '~' && szTmp[1] == '/')
{
/* Expand tilde. */
rc = RTPathUserHome(pszPath, cchPath - cchTmp + 2);
if (RT_FAILURE(rc))
return rc;
rc = RTPathAppend(pszPath, cchPath, &szTmp[2]);
}
else
rc = RTStrCopy(pszPath, cchPath, szTmp);
return rc;
}
}
#ifdef IPRT_USE_CORE_SERVICE_FOR_USER_DOCUMENTS
/*
* Fall back on FSFindFolder in case the above should fail...
*/
FSRef ref;
OSErr err = FSFindFolder(kOnAppropriateDisk, kDocumentsFolderType, false /* createFolder */, &ref);
if (err == noErr)
{
err = FSRefMakePath(&ref, (UInt8*)pszPath, cchPath);
if (err == noErr)
return VINF_SUCCESS;
}
#endif
Assert(RT_FAILURE_NP(rc));
return rc;
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:54,代码来源:RTPathUserDocuments-darwin.cpp
示例14: GetMacFolder
static std::string GetMacFolder(OSType folderType, const char* errorMsg) {
std::string ret;
FSRef ref;
char path[PATH_MAX];
OSStatus err = FSFindFolder( kUserDomain, folderType, kCreateFolder, &ref );
if (err != noErr) {
throw std::runtime_error(errorMsg);
}
FSRefMakePath( &ref, (UInt8*)&path, PATH_MAX );
ret = path;
return ret;
}
开发者ID:sago007,项目名称:PlatformFolders,代码行数:12,代码来源:platform_folders.cpp
示例15: GetLogsDirectory
RString CrashHandler::GetLogsDirectory()
{
FSRef fs;
char dir[PATH_MAX];
if( FSFindFolder(kUserDomain, kDomainLibraryFolderType, kDontCreateFolder, &fs) ||
FSRefMakePath(&fs, (UInt8 *)dir, PATH_MAX) )
{
return "/tmp";
}
return RString( dir ) + "/Logs/" PRODUCT_ID;
}
开发者ID:Ancaro,项目名称:stepmania,代码行数:12,代码来源:Crash.cpp
示例16: copyTemporaryFolderURL
CFURLRef copyTemporaryFolderURL(void) {
FSRef ref;
CFURLRef url = NULL;
OSStatus err = FSFindFolder(kOnAppropriateDisk, kTemporaryFolderType, kCreateFolder, &ref);
if (err != noErr)
NSLog(CFSTR("in copyTemporaryFolderPath in CFGrowlAdditions: Could not locate temporary folder because FSFindFolder returned %li"), (long)err);
else
url = CFURLCreateFromFSRef(kCFAllocatorDefault, &ref);
return url;
}
开发者ID:andrewsmedina,项目名称:iTerm2,代码行数:12,代码来源:CFGrowlAdditions.c
示例17: SHGetSpecialFolderLocation
/// Set File to hash in wxTextCtrl
void
AlcFrame::SetFileToHash()
{
#ifdef __WXMSW__
wxString browseroot;
LPITEMIDLIST pidl;
HRESULT hr = SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidl);
if (SUCCEEDED(hr)) {
if (!SHGetPathFromIDList(pidl, wxStringBuffer(browseroot, MAX_PATH))) {
browseroot = wxFileName::GetHomeDir();
}
} else {
browseroot = wxFileName::GetHomeDir();
}
if (pidl) {
LPMALLOC pMalloc;
SHGetMalloc(&pMalloc);
if (pMalloc) {
pMalloc->Free(pidl);
pMalloc->Release();
}
}
#elif defined(__WXMAC__)
FSRef fsRef;
wxString browseroot;
if (FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &fsRef) == noErr)
{
CFURLRef urlRef = CFURLCreateFromFSRef(NULL, &fsRef);
CFStringRef cfString = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle);
CFRelease(urlRef) ;
#if wxCHECK_VERSION(2, 9, 0)
browseroot = wxCFStringRef(cfString).AsString(wxLocale::GetSystemEncoding());
#else
browseroot = wxMacCFStringHolder(cfString).AsString(wxLocale::GetSystemEncoding());
#endif
} else {
browseroot = wxFileName::GetHomeDir();
}
#else
wxString browseroot = wxFileName::GetHomeDir();
#endif
const wxString & filename =
wxFileSelector (_("Select the file you want to compute the eD2k link"),
browseroot, wxEmptyString, wxEmptyString, wxT("*.*"),
wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
if (!filename.empty ())
{
m_inputFileTextCtrl->SetValue(filename);
}
}
开发者ID:dreamerc,项目名称:amule,代码行数:54,代码来源:alcframe.cpp
示例18: getAppDataPath
bool getAppDataPath(const std::string &appName, std::string &appDataPath) {
FSRef ref;
FSFindFolder(kUserDomain, kApplicationSupportFolderType, kCreateFolder, &ref);
char path[PATH_MAX];
FSRefMakePath(&ref, (UInt8*)&path, PATH_MAX);
appDataPath = std::string(path);
appDataPath += "/" + appName;
return true;
}
开发者ID:aaronmjacobs,项目名称:Shiny,代码行数:12,代码来源:OSUtils.cpp
示例19: FSFindFolder
QString QDesktopServices::storageLocation(const Location type)
{
if (QDesktopServices::Home == type)
return QDir::homePath();
// http://developer.apple.com/documentation/Carbon/Reference/Folder_Manager/folder_manager_ref/chapter_1.4_section_7.htm
FSRef ref;
OSErr err = FSFindFolder(kOnAppropriateDisk, translateLocation(type), false, &ref);
if (err)
return QString();
return getFullPath(ref);
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:13,代码来源:qdesktopservices_mac.cpp
示例20: GetTempFolderPath
static void GetTempFolderPath( uint16 *tempPath, size_t destMaxLength)
{
//Find the Temp directory
#if MSWindows
wchar_t tempFolderPath[4096];
GetTempPathW(4096,tempFolderPath);
StringCopy3D(tempPath,tempFolderPath, 4096);
#else
FSRef folderRef;
OSErr err = FSFindFolder( kOnSystemDisk, kTemporaryFolderType, true, &folderRef );
if ( err != noErr )
{
err = FSFindFolder( kOnAppropriateDisk, kTemporaryFolderType, true, &folderRef );
}
if(err != noErr)
{
wchar_t tempFolderPath[]=L"/tmp/";
StringCopy3D(tempPath,tempFolderPath, destMaxLength);
}
else
{
CFURLRef url = CFURLCreateFromFSRef( kCFAllocatorDefault, &folderRef );
CFStringRef cfString = NULL;
if ( url != NULL )
{
cfString = CFURLCopyFileSystemPath( url, kCFURLPOSIXPathStyle );
CFStringGetCString(cfString,(char*)tempPath,2048,kCFStringEncodingUnicode);
int32 len=CFStringGetLength(cfString);
CFRelease( url );
tempPath[len]='/';
tempPath[len+1]=0;
}
}
#endif
}
开发者ID:dannyyiu,项目名称:ps-color-test,代码行数:39,代码来源:3DHeightField.cpp
注:本文中的FSFindFolder函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论