Example #1
0
			const CString	GetDirectory(const CString& strPath){
				if(strPath.IsEmpty()){
					return L"";
				}
				CString strNewPath = RepairDirectorySlashes(strPath);

				if(strNewPath[strNewPath.GetLength()-1] == L'/'){
					if(strNewPath.GetLength() == 1){
						return L"/";
					}
					else{
						return strNewPath;
					}
				}

				unsigned uPos = 0;
				if(!strNewPath.FindLast(L"/", uPos)){
					return L"";
				}

				if(uPos == 0){
					return L"/";
				}

				return strNewPath.SubString(0, uPos) + L"/";
			}
Example #2
0
			const CString	GetDirectoryBase(const CString& strPath){
				CString strDirectory = GetDirectory(strPath);
				if(strDirectory.IsEmpty() || strDirectory == L"/"){
					return L"";
				}

				unsigned uPos = 0;
				if(!strDirectory.FindLast(L"/", strDirectory.GetLength() - 2, uPos)){
					return strDirectory.SubString(0, strDirectory.GetLength() - 1);
				}

				return strDirectory.SubStringIndexed(uPos + 1, strDirectory.GetLength() - 1);
			}
Example #3
0
			const CString	GetFilenameBase(const CString& strPath){
				CString strFilename = GetFilename(strPath);

				unsigned uDotPos = 0;
				if(!strFilename.FindLast(L".", uDotPos)){
					return strFilename;
				}

				if(uDotPos == 0){
					return L"";
				}

				return strFilename.SubString(0, uDotPos);
			}
Example #4
0
			const CString	GetFilenameExt(const CString& strPath){
				CString strFilename = GetFilename(strPath);

				unsigned uDotPos = 0;
				if(!strFilename.FindLast(L".", uDotPos)){
					return L"";
				}

				if(uDotPos + 1 == strFilename.GetLength()){
					return L"";
				}

				return strFilename.SubString(uDotPos + 1);
			}
Example #5
0
			const CString	GetFilename(const CString& strPath){
				if(strPath.IsEmpty()){
					return L"";
				}
				CString strNewPath = RepairDirectorySlashes(strPath);

				unsigned uPos = 0;
				if(!strNewPath.FindLast(L"/", uPos)){
					return strNewPath;
				}

				if(uPos == 0 && strNewPath.GetLength() == 1){
					return L"";
				}

				if(uPos + 1 == strNewPath.GetLength()){
					return L"";
				}

				return strNewPath.SubString(uPos + 1);
			}