本文整理汇总了C++中FSPath::GetUnicode方法的典型用法代码示例。如果您正苦于以下问题:C++ FSPath::GetUnicode方法的具体用法?C++ FSPath::GetUnicode怎么用?C++ FSPath::GetUnicode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSPath
的用法示例。
在下文中一共展示了FSPath::GetUnicode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Rename
int FSSys::Rename ( FSPath& oldpath, FSPath& newpath, int* err, FSCInfo* info )
{
if ( MoveFileW(
SysPathStr( _drive, oldpath.GetUnicode( '\\' ) ).data(),
SysPathStr( _drive, newpath.GetUnicode( '\\' ) ).data()
) ) { return 0; }
SetError( err, GetLastError() );
return -1;
}
示例2: CreateFileW
int FSSys::OpenCreate ( FSPath& path, bool overwrite, int mode, int flags, int* err, FSCInfo* info )
{
DWORD diseredAccess = GENERIC_READ | GENERIC_WRITE;
DWORD shareMode = 0;
DWORD creationDisposition = ( overwrite ) ? CREATE_ALWAYS : CREATE_NEW;
//???
HANDLE h = CreateFileW( SysPathStr( _drive, path.GetUnicode( '\\' ) ).data(), diseredAccess, FILE_SHARE_WRITE, 0, creationDisposition, 0, 0 );
if ( h == INVALID_HANDLE_VALUE )
{
SetError( err, GetLastError() );
return -1;
}
int fd = handles.New();
HANDLE* p = this->handles.Handle( fd );
if ( !p )
{
SetError( err, ERROR_INVALID_PARAMETER );
CloseHandle( h );
return -1;
}
*p = h;
return fd;
}
示例3: OpenRead
int FSSys::OpenRead ( FSPath& path, int flags, int* err, FSCInfo* info )
{
int shareFlags = 0;
if ( flags & FS::SHARE_READ ) { shareFlags |= FILE_SHARE_READ; }
if ( flags & FS::SHARE_WRITE ) { shareFlags |= FILE_SHARE_WRITE; }
HANDLE h = CreateFileW( SysPathStr( _drive, path.GetUnicode( '\\' ) ).data(), GENERIC_READ, shareFlags, 0, OPEN_EXISTING, 0, 0 );
//file_open(SysPathStr(_drive, path.GetUnicode('\\')).ptr());
if ( h == INVALID_HANDLE_VALUE )
{
SetError( err, GetLastError() );
return -1;
}
int fd = handles.New();
HANDLE* p = this->handles.Handle( fd );
if ( !p )
{
SetError( err, ERROR_INVALID_PARAMETER );
CloseHandle( h );
return -1;
}
*p = h;
return fd;
}
示例4: MkDir
int FSSys::MkDir( FSPath& path, int mode, int* err, FSCInfo* info )
{
if ( CreateDirectoryW( SysPathStr( _drive, path.GetUnicode( '\\' ) ).data(), 0 ) ) { return 0; }
DWORD e = GetLastError();
if ( e == ERROR_ALREADY_EXISTS ) { return 0; }
SetError( err, e );
return -1;
}
示例5: Stat
int FSSys::Stat( FSPath& path, FSStat* fsStat, int* err, FSCInfo* info )
{
if ( _drive >= 0 && path.Count() == 1 || _drive == -1 && path.Count() == 3 )
{
//pseudo stat
fsStat->size = 0;
fsStat->dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
fsStat->mode = S_IFDIR;
fsStat->mtime = 0;
fsStat->mode |= 0664;
return 0;
}
WIN32_FIND_DATAW ent;
HANDLE handle = FindFirstFileW( SysPathStr( _drive, path.GetUnicode() ).data(), &ent );
if ( handle == INVALID_HANDLE_VALUE )
{
SetError( err, GetLastError() );
return -1;
}
try
{
fsStat->size = ( seek_t( ent.nFileSizeHigh ) << 32 ) + ent.nFileSizeLow;
fsStat->dwFileAttributes = ent.dwFileAttributes;
fsStat->mtime = ent.ftLastWriteTime;
if ( ent.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
{
fsStat->mode = S_IFDIR;
}
else
{
fsStat->mode = S_IFREG;
}
fsStat->mode |= 0664;
FindClose( handle );
return 0;
}
catch ( ... )
{
FindClose( handle );
throw;
}
//...
SetError( err, 50 );
return -1;
}
示例6: RmDir
int FSSys::RmDir( FSPath& path, int* err, FSCInfo* info )
{
std::vector<wchar_t> sp = SysPathStr( _drive, path.GetUnicode( '\\' ) );
if ( RemoveDirectoryW( sp.data() ) ) { return 0; }
DWORD lastError = GetLastError();
if ( lastError == ERROR_ACCESS_DENIED ) //возможно read only аттрибут, пытаемся сбросить
{
if ( SetFileAttributesW( sp.data(), 0 ) && RemoveDirectoryW( sp.data() ) ) { return 0; }
lastError = GetLastError();
}
SetError( err, lastError );
return -1;
}
示例7: SetFileTime
int FSSys::SetFileTime ( FSPath& path, FSTime aTime, FSTime mTime, int* err, FSCInfo* info )
{
HANDLE h = CreateFileW( SysPathStr( _drive, path.GetUnicode( '\\' ) ).data(), FILE_WRITE_ATTRIBUTES , 0, 0, OPEN_EXISTING, 0, 0 );
if ( h == INVALID_HANDLE_VALUE )
{
SetError( err, GetLastError() );
return -1;
}
FILETIME at = aTime;
FILETIME mt = mTime;
if ( !::SetFileTime( h, NULL, &at, &mt ) )
{
SetError( err, GetLastError() );
CloseHandle( h );
return -1;
}
CloseHandle( h );
return 0;
}
示例8: Rename
int FSTmp::Rename(FSPath& oldpath, FSPath& newpath, int* err, FSCInfo* info)
{
FSTmpNode* n = rootDir.findByName(oldpath.GetItem(oldpath.Count() - 1));
if (n == 0)
{
return FS::SetError(err, FSTMP_ERROR_FILE_NOT_FOUND);
}
else
{
if (n->nodeType == FSTmpNode::NODE_FILE)
{
int ret = baseFS->Rename(n->baseFSPath, newpath, err, info);
if (ret != 0)
return ret;
n->name = newpath.GetUnicode();
return SetError(err, 0);
}
else
{// XXX ??? add case when new and old path are in different dirs
((FSTmpNode*)(n))->name = *newpath.GetItem(newpath.Count() - 1);
return SetError(err, 0);
}
}
}
示例9: Uri
FSString FSSys::Uri( FSPath& path )
{
unicode_t pref[0x100];
unicode_t* p = pref;
if ( _drive > 0 && _drive < 'z' - 'a' + 1 ) //+1 ???
{
*( p++ ) = 'A' + _drive;
*( p++ ) = ':';
}
else if ( _drive == -1 )
{
*( p++ ) = '\\';
}
else
{
*( p++ ) = '?';
*( p++ ) = ':';
}
*p = 0;
return FSString( carray_cat<unicode_t>( pref, path.GetUnicode() ).data() );
}