bool CClause::CanHaveEncloseClauseFromTheLeft() const { return !HasSubConj() && !HasAtLeastOneSimConj() && !IsRelative(); };
bool Source::IsRelative() const { #ifdef HAS_AUDIO_SOURCE return impl->IsRelative(); #else throw System::PunkException(L"Audio source is not available"); #endif }
BOOL CFilePath::MakeAbsolute(CFilePath const &BasePath) { if (IsRelative()) { msPath = BasePath & msPath; return TRUE; } return FALSE; }
Path MakeNormalizedAbsolute(const Path& pth, size_t len) { Path res(pth); if(IsRelative(res)) res = Path(FetchCurrentWorkingDirectory(len)) / res; res.Normalize(); YTraceDe(Debug, "Converted path is '%s'.", string(res).c_str()); YAssert(IsAbsolute(res), "Invalid path converted."); return res; }
std::string FileUtil::GetFullPath(const std::string ¤tDir, const std::string &relFN) { std::string res,resAux; if (IsRelative(relFN)) { resAux = currentDir + SLASH + relFN; res = CleanFullPath(resAux); } else res = CleanFullPath(relFN); return res; }
CFilePath &CFilePath::MakeFullPath() { if (!IsRelative()) return *this; LPTSTR psDummy = NULL; DWORD dwChars = GetFullPathName(msPath, 0, NULL, &psDummy); _ASSERTE(dwChars > 0); CString psFull; dwChars = GetFullPathName(msPath, dwChars, CStringLock(psFull, dwChars), &psDummy); msPath = psFull; return *this; }
String System::MakePath(const String& file,const String& path) { if(IsRelative(file)) { return NormalPath(AdjustPath(path,true)+file); } else if(file=="/"||file=="\\") { int pos=path.find(':'); if(pos<0) { return "/"; } else { return path.substr(0,pos); } } else { return NormalPath(file); } }
std::string GetAbsolute(const std::string& path, const std::string& base) { if (IsRelative(path)) return base + DIR_SEP + path; return path; }
bool CClause::HasLeftStarter() const { return HasSubConj() || (m_iFirstWord == 0) || IsRelative(); }
static DWORD copy(__CMD_PARA_OBJ* pCmdObj) { #ifdef __CFG_SYS_DDF HANDLE hSourceFile = NULL; HANDLE hDestinationFile = NULL; char* pBuffer = NULL; DWORD dwReadSize = 0; DWORD dwWriteSize = 0; DWORD dwTotalRead = 0; char srcFullName[MAX_FILE_NAME_LEN]; char dstFullName[MAX_FILE_NAME_LEN]; DWORD dwFileSize = 0; DWORD dwBatSize = 0; if (pCmdObj->byParameterNum < 3) { _hx_printf("Please specify the source and destination file name.\r\n"); goto __TERMINAL; } /* Construct source file's full name. */ if (IsRelative(pCmdObj->Parameter[1])) { /* Append current directory into the relative file name. */ strcpy(srcFullName, FsGlobalData.CurrentDir); strcat(srcFullName, pCmdObj->Parameter[1]); } else { strcpy(srcFullName, pCmdObj->Parameter[1]); } ToCapital(srcFullName); /* Construct destination file's full name. */ if (IsRelative(pCmdObj->Parameter[2])) { /* Append current directory into the relative file name. */ strcpy(dstFullName, FsGlobalData.CurrentDir); strcat(dstFullName, pCmdObj->Parameter[2]); } else { strcpy(dstFullName, pCmdObj->Parameter[2]); } ToCapital(dstFullName); /* Can not copy one file to itself. */ if (0 == strcmp(srcFullName, dstFullName)) { _hx_printf("Can not copy a file to it's self.\r\n"); goto __TERMINAL; } /* Try to open the source file. */ hSourceFile = IOManager.CreateFile((__COMMON_OBJECT*)&IOManager, srcFullName, FILE_ACCESS_READ, 0, NULL); if (NULL == hSourceFile) { _hx_printf("Can not open the source file[%s].\r\n", srcFullName); goto __TERMINAL; } /* Try to open or create the destination file name. */ hDestinationFile = IOManager.CreateFile((__COMMON_OBJECT*)&IOManager, dstFullName, FILE_OPEN_ALWAYS, 0, NULL); if (NULL == hDestinationFile) { _hx_printf("Can not open the target file[%s].\r\n", dstFullName); goto __TERMINAL; } /* Get the source file's size. */ dwFileSize = GetFileSize(hSourceFile, NULL); dwBatSize = dwFileSize / 20; /* Allocate a buffer to hold the file's data. */ #define __TMP_FILE_BUFFSZ (64 * 1024) pBuffer = (char*)_hx_malloc(__TMP_FILE_BUFFSZ); if (NULL == pBuffer) { _hx_printf("Failed to allocate data buffer.\r\n"); goto __TERMINAL; } /* Copy data now. */ do { /* Read the source file. */ if (!IOManager.ReadFile((__COMMON_OBJECT*)&IOManager, hSourceFile, __TMP_FILE_BUFFSZ, pBuffer, &dwReadSize)) { _hx_printf("Can not read the source file.\r\n"); goto __TERMINAL; } /* Write the data block into destination file. */ if (!IOManager.WriteFile((__COMMON_OBJECT*)&IOManager, hDestinationFile, dwReadSize, pBuffer, &dwWriteSize)) { _hx_printf("Failed to write data into target file.\r\n"); goto __TERMINAL; } dwTotalRead += dwReadSize; /* Show out copying progress. */ if (dwBatSize < dwReadSize) { _hx_printf("."); dwBatSize = dwFileSize / 20; } else { dwBatSize -= dwReadSize; } } while (dwReadSize == __TMP_FILE_BUFFSZ); #undef __TMP_FILE_BUFFSZ _hx_printf("\r\n"); _hx_printf("[copy]: %d byte(s) copied.\r\n", dwTotalRead); __TERMINAL: if (NULL != hSourceFile) { IOManager.CloseFile((__COMMON_OBJECT*)&IOManager, hSourceFile); } if (NULL != hDestinationFile) { IOManager.CloseFile((__COMMON_OBJECT*)&IOManager, hDestinationFile); } if (NULL != pBuffer) { _hx_free(pBuffer); } return SHELL_CMD_PARSER_SUCCESS;; #else return FS_CMD_FAILED; #endif }