本文整理匯總了C++中AppendFileName函數的典型用法代碼示例。如果您正苦於以下問題:C++ AppendFileName函數的具體用法?C++ AppendFileName怎麽用?C++ AppendFileName使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AppendFileName函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: AppendFileName
void Updater::DO_Uninstall(void)
{
// removes executable
String path;
#ifdef PLATFORM_POSIX
path = AppendFileName(GetProgramsFolder(), appName);
#else
path = AppendFileName(GetProgramsFolder(), appName + "/" + appName + ".exe");
#endif
FileDelete(path);
// removes system config folder
// leaves user one alone, it can contain user data
// (on win32, that's also the program folder)
DeleteFolderDeep(systemConfigPath);
// unlink application from shess
ShellUnlink();
// signal op success and leave
// as it was uninstalling, it will restart
// launching app (uninstaller, possibily)
SucceedUpdate();
RestartApp(RestartTemp);
}
示例2: LocalHost
String MakeBuild::OutDir(const Index<String>& cfg, const String& package, const VectorMap<String, String>& bm,
bool use_target)
{
Index<String> excl;
excl.Add(bm.Get("BUILDER", "GCC"));
excl.Add("MSC");
LocalHost().AddFlags(excl);
Vector<String> x;
bool dbg = cfg.Find("DEBUG_FULL") >= 0 || cfg.Find("DEBUG_MINIMAL") >= 0;
if(cfg.Find("DEBUG") >= 0) {
excl.Add("BLITZ");
if(cfg.Find("BLITZ") < 0)
x.Add("NOBLITZ");
}
else
if(dbg)
x.Add("RELEASE");
if(use_target)
excl.Add("MAIN");
for(int i = 0; i < cfg.GetCount(); i++)
if(excl.Find(cfg[i]) < 0)
x.Add(cfg[i]);
Sort(x);
for(int i = 0; i < x.GetCount(); i++)
x[i] = InitCaps(x[i]);
String outdir = GetVar("OUTPUT");
if(output_per_assembly)
outdir = AppendFileName(outdir, GetVarsName());
if(!use_target)
outdir = AppendFileName(outdir, package);
outdir = AppendFileName(outdir, GetFileTitle(method) + "." + Join(x, "."));
outdir = Filter(outdir, CharFilterSlash);
return outdir;
}
示例3: Exclamation
void MapEditor::OnLevelMapCalc(Level& level, int number)
{
if (level.GetMapBG().IsEmpty())
{
Exclamation(NFormat(t_("Please, select the image for level: %s"), level.GetName()));
return;
}
String fp = AppendFileName( AppendFileName( GetFileDirectory(GetExeFilePath()), "Maps"),
level.GetMapBG());
if (!FileExists(fp))
{
Exclamation(NFormat(t_("Image file not exist: %s"), fp));
return;
}
String name = level.GetName();
double zx = level.GetZoomDX();
Size pz = level.GetPageSize();
Size sz = level.GetCellSize();
FileIn in(fp);
One<StreamRaster> r = StreamRaster::OpenAny(in);
if (!r)
{
Exclamation(NFormat(t_("Error while loading image file: %s"), fp));
return;
}
Image img = r->GetImage();
Calculate(sz.cx, sz.cy, pz.cx, pz.cy, zx,
NFormat("%s-%d", _map.GetName(), number + 1), img);
}
示例4: SaveFile
void Ide::ExportProject(const String& ep, bool all, bool gui, bool deletedir)
{
SaveFile(false);
::Workspace wspc;
wspc.Scan(main);
Index<String> used;
HdependClearDependencies();
for(int i = 0; i < wspc.GetCount(); i++) {
const Package& p = wspc.GetPackage(i);
String pn = wspc[i];
for(int j = 0; j < p.GetCount(); j++) {
const Package::File& f = p[j];
if(!f.separator) {
String p = SourcePath(pn, f);
used.FindAdd(p);
Vector<String> d = HdependGetDependencies(p);
for(int q = 0; q < d.GetCount(); q++)
used.FindAdd(d[q]);
for(int q = 0; q < f.depends.GetCount(); q++)
used.FindAdd(SourcePath(pn, f.depends[q].text));
}
}
}
if(FileExists(ep)) {
if(gui && !PromptYesNo(DeQtf(ep) + " is existing file.&"
"Do you want to delete it?")) return;
FileDelete(ep);
}
if(deletedir && DirectoryExists(ep)) {
if(gui && !PromptYesNo(DeQtf(ep) + " is existing directory.&"
"Do you want to replace it?")) return;
DeleteFolderDeep(ep);
}
Progress pi("Exporting project");
pi.SetTotal(wspc.GetCount());
for(int i = 0; i < wspc.GetCount(); i++) {
if(gui && pi.StepCanceled())
return;
CopyFolder(AppendFileName(ep, wspc[i]), PackageDirectory(wspc[i]), used, all, true);
}
Vector<String> upp = GetUppDirs();
for(int i = 0; i < upp.GetCount(); i++) {
if(gui && pi.StepCanceled())
return;
String d = upp[i];
FindFile ff(AppendFileName(d, "*"));
while(ff) {
if(ff.IsFile()) {
String fn = ff.GetName();
String path = AppendFileName(d, fn);
if(all || used.Find(path) >= 0)
CopyFile(AppendFileName(ep, fn), path, true);
}
ff.Next();
}
CopyFolder(AppendFileName(ep, wspc[i]), PackageDirectory(wspc[i]), used, all, true);
}
ExportMakefile(ep);
}
示例5: ToUpper
void CodeBrowser::Load()
{
String find = ToUpper((String)~search);
String match = ToUpper((String)~search_scope);
String pm = GetPm();
Vector<String> txt;
Vector<Value> ndx;
Index<int> fi;
Index<String> fs;
for(int i = 0; i < CodeBase().GetCount(); i++) {
String s = CodeBase().GetKey(i);
const Array<CppItem>& n = CodeBase()[i];
if(s.GetCount())
if(MatchCib(s, match) && (MatchCib(s, find) || HasItem(n, find)) && MatchPm(n, pm)) {
txt.Add(s);
ndx.Add(s);
}
for(int i = 0; i < n.GetCount(); i++) {
int f = n[i].file;
if(fi.Find(f) < 0) {
String s = GetFileText(GetSourceFilePath(f));
if(s.StartsWith(pm) && MatchCib(s, match) &&
(IsNull(find) || MatchCib(s, find) || n[i].uname.StartsWith(find))) {
txt.Add(s);
ndx.Add(f);
fs.Add(s);
fi.Add(f);
}
}
}
}
const Workspace& wspc = GetIdeWorkspace();
for(int i = 0; i < wspc.GetCount(); i++) {
String pn = wspc[i];
const Package& p = wspc.GetPackage(i);
String pp = PackageDirectory(pn);
for(int j = 0; j < p.GetCount(); j++)
if(!p[j].separator) {
String fn = AppendFileName(pp, p[j]);
String s = GetFileText(AppendFileName(pn, p[j]));
if(fs.Find(s) < 0 && (IsNull(find) || MatchCib(s, find)) && MatchCib(s, match) && MatchPm(fn, pm)) {
int f = GetSourceFileIndex(SourcePath(pn, p[j]));
txt.Add(s);
ndx.Add(f);
fs.Add(s);
}
}
}
IndexSort(txt, ndx, ScopeLess());
Value key = scope.GetKey();
int sc = scope.GetCursorSc();
scope.Clear();
for(int i = 0; i < txt.GetCount(); i++)
scope.Add(IsString(ndx[i]) ? ndx[i] : Null, txt[i], ndx[i]);
if(scope.FindSetCursor(key))
scope.ScCursor(sc);
// clear.Enable(IsSearch());
}
示例6: InstallProgramGroup
bool InstallProgramGroup(const char *exe, const char *groupname, const char *lnk, int icon)
{
String dir = GetShellFolder("Common Programs", HKEY_LOCAL_MACHINE);
if(groupname) {
dir = AppendFileName(dir, groupname);
CreateDirectory(dir, NULL);
}
return CreateShellLink(exe, AppendFileName(dir, lnk), "", icon);
}
示例7: AppendFileName
void GrabScreen::Init(GrabYourScreen &_program) {
program = &_program;
editFileNameGrab <<= AppendFileName(GetDesktopFolder(), "ScreenGrab.avi");
editFileNameGrab.Type(t_("Video file"), ".avi");
editTime <<= 5;
editFrameRate <<= 1;
opGrabMouse <<= true;
swGrabMode.Add("Desktop");
swGrabMode.Add("Window");
#if defined(PLATFORM_WIN32)
swGrabMode.Add("Rectangle");
#endif
swGrabMode.MinCaseHeight(20);
swGrabMode.SetData(0);
swGrabMode.WhenAction = THISBACK(SwGrabMode_Action);
SwGrabMode_Action();
#if defined(PLATFORM_WIN32)
butGrab.WhenPush = THISBACK(ButGrab_Push);
#else
butGrab.Enable(false);
editFileNameGrab.Enable(false);
editTime.Enable(false);
editFrameRate.Enable(false);
opGrabMouse.Enable(false);
editLeft.Hide();
editTop.Hide();
editWidth.Hide();
editHeight.Hide();
left.Hide();
top.Hide();
width.Hide();
height.Hide();
#endif
editLeft <<= 100;
editWidth <<= 1000;
editTop <<= 100;
editHeight <<= 900;
String extension;
editFileNameSnap <<= AppendFileName(GetDesktopFolder(), "ScreenSnap.jpg");
editFileNameSnap.Type(t_("Image file"), ".jpg");
butSnap.WhenPush = THISBACK(ButSnap_Push);
Array<int64> hWnd, processId;
Array<String> name, fileName, caption;
GetWindowsList(hWnd, processId, name, fileName, caption, false);
Sort(caption);
for (int i = 0; i < caption.GetCount(); ++i) {
if (!Trim(caption[i]).IsEmpty())
editWindowTitle.Add(caption[i]);
}
editWindowTitle.SetData(editWindowTitle.GetValue(0));
SetTimeCallback(-1000, THISBACK(Timer));
}
示例8: AppendFileName
int DlgCompareDir::Refresh(String rel_path, int parent)
{
FindFile ff;
VectorMap<String, FileInfo> afile, bfile;
VectorMap<String, String> adir, bdir;
String arel = AppendFileName(pa, rel_path);
String brel = AppendFileName(pb, rel_path);
int done = 0;
if(!FetchDir(arel, afile, adir))
done |= 2;
if(!FetchDir(brel, bfile, bdir))
done |= 1;
Index<String> dir_index;
dir_index <<= adir.GetIndex();
FindAppend(dir_index, bdir.GetKeys());
Vector<String> dirs(dir_index.PickKeys());
Sort(dirs, GetLanguageInfo());
for(int i = 0; i < dirs.GetCount(); i++) {
int fa = adir.Find(dirs[i]), fb = bdir.Find(dirs[i]);
String dn = (fb >= 0 ? bdir[fb] : adir[fa]);
int dirpar = tree.Add(parent, CtrlImg::Dir(), dn);
int dirdone = Refresh(AppendFileName(rel_path, dirs[i]), dirpar);
done |= dirdone;
switch(dirdone) {
case 0: tree.Remove(dirpar); break;
case 1: tree.SetNode(dirpar, TreeCtrl::Node().SetImage(CompDirImg::a_dir()).Set(dn)); break;
case 2: tree.SetNode(dirpar, TreeCtrl::Node().SetImage(CompDirImg::b_dir()).Set(dn)); break;
case 3: tree.SetNode(dirpar, TreeCtrl::Node().SetImage(CompDirImg::ab_dir()).Set(dn)); break;
}
}
Index<String> name_index;
name_index <<= afile.GetIndex();
FindAppend(name_index, bfile.GetKeys());
Vector<String> names(name_index.PickKeys());
Sort(names, GetLanguageInfo());
for(int i = 0; i < names.GetCount(); i++) {
int fa = afile.Find(names[i]), fb = bfile.Find(names[i]);
if(fa < 0) {
tree.Add(parent, CompDirImg::b_file(), NFormat("%s: B (%`, %0n)", bfile[fb].name, bfile[fb].time, bfile[fb].size));
done |= 2;
}
else if(fb < 0) {
tree.Add(parent, CompDirImg::a_file(), NFormat("%s: A (%`, %0n)", afile[fa].name, afile[fa].time, afile[fa].size));
done |= 1;
}
else if(afile[fa].size != bfile[fb].size
|| LoadFile(AppendFileName(arel, names[i])) != LoadFile(AppendFileName(brel, names[i]))) {
tree.Add(parent, CompDirImg::ab_file(), NFormat("%s: A (%`, %0n), B (%`, %0n)",
bfile[fb].name, afile[fa].time, afile[fa].size, bfile[fb].time, bfile[fb].size));
done |= 3;
}
}
return done;
}
示例9: GetTreePath
void DlgCompareDir::DoTreeCursor()
{
String s = GetTreePath();
if(IsNull(s))
return;
String fa = AppendFileName(pa, s), fb = AppendFileName(pb, s);
String da = LoadFile(fa), db = LoadFile(fb);
if(!IsNull(da) || !IsNull(db)) {
if(IsNull(da) || IsNull(db)) {
qtf.Hide();
lineedit.Show();
lineedit <<= Nvl(db, da);
}
else {
lineedit.Hide();
qtf.Show();
String comptext = "[C2 ";
Vector<String> la = GetStringLineMap(da), lb = GetStringLineMap(db);
Array<TextSection> sections = CompareLineMaps(la, lb);
for(int s = 0; s < sections.GetCount(); s++) {
const TextSection& sec = sections[s];
if(sec.same) {
comptext << "[@(0.0.0) \1";
if(sec.count1 <= 6)
for(int i = 0; i < sec.count1; i++)
comptext << ExpandTabs(la[i + sec.start1]) << '\n';
else {
for(int i = 0; i < 3; i++)
comptext << ExpandTabs(la[i + sec.start1]) << '\n';
comptext << "...\n";
for(int i = -3; i < 0; i++)
comptext << ExpandTabs(la[i + sec.start1 + sec.count1]) << '\n';
}
comptext << "\1]";
}
else {
if(sec.count1) {
comptext << "[@(0.160.0) \1";
for(int i = 0; i < sec.count1; i++)
comptext << ExpandTabs(la[sec.start1 + i]) << '\n';
comptext << "\1]";
}
if(sec.count2) {
comptext << "[@(0.0.255) \1";
for(int i = 0; i < sec.count2; i++)
comptext << ExpandTabs(lb[sec.start2 + i]) << '\n';
comptext << "\1]";
}
}
}
qtf.SetQTF(comptext);
}
}
}
示例10: FetchMaxValidVersion
// fetch the new app version from server
// and replaces older one
// if ver is not specified, fetches the maximum available
// one but which is less than or equal maxVersion
bool Updater::FetchApp(ProductVersion ver, bool devel)
{
int err = 0;
if(!ver)
ver = FetchMaxValidVersion(acceptDevelVersions);
if(!ver)
return false;
String appServerPath, destPath;
#ifdef PLATFORM_POSIX
appServerPath = GetPlatformRoot() + ver.ToString() + "/" + appName;
destPath = AppendFileName(GetProgramsFolder(), appName);
#else
appServerPath = GetPlatformRoot() + ver.ToString() + "/" + appName + ".exe";
destPath = AppendFileName(GetProgramsFolder(), appName + "\\" + appName + ".exe");
RealizePath(destPath);
#endif
if(isWebServer)
{
http.Url(appServerPath);
http.Timeout(1000*60*30);
http.MaxContentSize(100000000);
http.WhenDo = THISBACK(doProgress);
// fetch version file from server
appBuffer = http.Execute();
err = http.GetStatusCode();
if(err != 200 || http.IsAbort() || http.IsError())
{
appBuffer = "";
return false;
}
// replaces/installs app
if(!SaveFile(destPath, appBuffer))
return false;
}
else
FileCopy(appServerPath, destPath);
#ifdef PLATFORM_POSIX
if(chmod(~destPath, 0755) != 0)
return false;
#endif
// stores current version inside system config path
if(!SaveFile(AppendFileName(systemConfigPath, "version"), ver.ToString()))
return false;
installedVersion = ver;
return true;
}
示例11: START_Uninstall
// app started, must check for update/install requests
// returns true if app must continue execution, false otherwise
bool Updater::DO_NormalRun(void)
{
// we now check if we just want to uninstall app
// it can be done by command line --UNINSTALL option
if(CommandLine().GetCount() && CommandLine()[0] == "--UNINSTALL")
return START_Uninstall();
// if app not installed, we shall install it
// (if any available version is present on server....)
if(!appInstalled)
{
// fetch available application versions
ProductVersions versions = FetchVersions();
// if versions present on server, install latest
if(versions.GetCount())
return START_Install();
// otherwise resume execution -- it's an uninstalled run
else
return true;
}
// not installing nor uninstalling
// we shall check which kind of update is enabled
String updateMode;
if(!FileExists(AppendFileName(userConfigPath, "UPDATER_MODE")))
{
updateMode = "ASK";
SaveFile(AppendFileName(userConfigPath, "UPDATER_MODE"), updateMode);
}
else
updateMode = LoadFile(AppendFileName(userConfigPath, "UPDATER_MODE"));
// if updates are disabled, just do nothing
if(updateMode == "DISABLED")
return true;
// if we don't have a new version available, just do nothing
ProductVersion maxVer;
if( (maxVer = FetchMaxValidVersion(acceptDevelVersions)) <= installedVersion)
return true;
// if we want manual updates, just ask
if(updateMode == "ASK")
if(!PromptYesNo(Format(t_("New version '%s' is available&Install it ?"), maxVer.ToString())))
return true;
// updater enabled, start it
// if update failed, resume normal run, otherwise exit
// as the app will be launched again by updater itself
return START_Update();
}
示例12: InitWwwTpp
void InitWwwTpp()
{
String wwwtpp = AppendFileName(uppbox, "uppweb/www.tpp");
FindFile ff(AppendFileName(wwwtpp, "*"));
static Vector<String> data;
while(ff) {
RLOG(ff.GetName());
Topic p = ReadTopic0(LoadFile(AppendFileName(wwwtpp, ff.GetName())));
data.Add(p.text);
RegisterTopic__("<uppweb/www.tpp/all.i>", GetFileTitle(ff.GetName()), p.title, data.Top(), data.Top().GetCount());
ff.Next();
}
};
示例13: NativePath
String Nest::PackagePath0(const String& name)
{
String uppfile = NativePath(name);
if(IsFullPath(uppfile)) return NormalizePath(uppfile);
Vector<String> d = GetUppDirs();
String p;
for(int i = 0; i < d.GetCount(); i++) {
p = NormalizePath(AppendFileName(AppendFileName(d[i], uppfile),
GetFileName(uppfile)) + ".upp");
if(FileExists(p)) return p;
}
return d.GetCount() ? NormalizePath(AppendFileName(AppendFileName(d[0], uppfile),
GetFileName(uppfile)) + ".upp") : "";
}
示例14: SearchForFiles
void SearchForFiles(Index<String>& files, String dir, String mask, int readonly, Progress& pi) {
FindFile ff(AppendFileName(dir, "*.*"));
while(ff) {
if(ff.IsFolder() && *ff.GetName() != '.')
SearchForFiles(files, AppendFileName(dir, ff.GetName()), mask, readonly, pi);
else
if(ff.IsFile() && PatternMatchMulti(mask, ff.GetName())) {
if(IsNull(readonly) || !!readonly == !!ff.IsReadOnly()) {
if(pi.StepCanceled()) return;
files.FindAdd(AppendFileName(dir, ff.GetName()));
}
}
ff.Next();
}
}
示例15: UrpMain
//==============================================================================================
int UrpMain(UrpTopWindow &ctrlMain) {
// When the dev version is run, it uses the config files in that folder so as to avoid
// disturbing the useful user settings on the same computer for the app installed in
// "Program Files".
ASSERT(&ctrlMain);
ctrlMain.configFileNameBase = ToLower(UrpString::GetWord(ctrlMain.Name(), 1)); // Get 2nd word in string (index zero-based)
ctrlMain.binConfigFile = AppendFileName(ctrlMain.configFileFolder, ctrlMain.configFileNameBase + BIN_TAIL);
ctrlMain.xmlConfigFile = AppendFileName(ctrlMain.configFileFolder, ctrlMain.configFileNameBase + XML_TAIL);
RunWithConfig(ctrlMain, CONFIGACTION_LOAD_AND_SAVE, WINDOWINSTANCINGMETHOD_RUN);
return 0; // Default exit code historically means success (MS-DOS)
};