本文整理汇总了C++中SourceFile::GetPath方法的典型用法代码示例。如果您正苦于以下问题:C++ SourceFile::GetPath方法的具体用法?C++ SourceFile::GetPath怎么用?C++ SourceFile::GetPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SourceFile
的用法示例。
在下文中一共展示了SourceFile::GetPath方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
Project::HasLibrary(const char *path)
{
if (!path)
return false;
for (int32 i = 0; i < fLibraryList.CountItems(); i++)
{
SourceFile *file = (SourceFile*)fLibraryList.ItemAt(i);
if (file && strcmp(file->GetPath().GetFullPath(),path) == 0)
return true;
}
return false;
}
示例2: partnerPath
void
FindWindow::SetProject(Project *proj)
{
fFileList.MakeEmpty();
if (!proj)
return;
for (int32 i = 0; i < proj->CountGroups(); i++)
{
SourceGroup *group = proj->GroupAt(i);
for (int32 j = 0; j < group->filelist.CountItems(); j++)
{
SourceFile *file = group->filelist.ItemAt(j);
fFileList.AddItem(new BString(file->GetPath().GetFullPath()));
entry_ref partnerRef = GetPartnerRef(file->GetPath().GetRef());
if (partnerRef.name)
{
DPath partnerPath(partnerRef);
fFileList.AddItem(new BString(partnerPath.GetFullPath()));
}
}
}
}
示例3: GroupAt
SourceFile *
Project::FindFile(const char *path)
{
if (!path)
return NULL;
for (int32 i = 0; i < CountGroups(); i++)
{
SourceGroup *group = GroupAt(i);
for (int32 j = 0; j < group->filelist.CountItems(); j++)
{
SourceFile *src = group->filelist.ItemAt(j);
if (src && strcmp(src->GetPath().GetFullPath(),path) == 0)
return src;
}
}
return NULL;
}
示例4: newfile
bool
Project::HasFileName(const char *name)
{
if (!name)
return false;
DPath newfile(name);
for (int32 i = 0; i < CountGroups(); i++)
{
SourceGroup *group = GroupAt(i);
for (int32 j = 0; j < group->filelist.CountItems(); j++)
{
SourceFile *src = group->filelist.ItemAt(j);
if (src && strcmp(src->GetPath().GetFileName(),newfile.GetFileName()) == 0)
return true;
}
}
return false;
}
示例5: TemplateWindow
//.........这里部分代码省略.........
sWindowCount++;
break;
}
case M_DEREGISTER_WINDOW:
{
sWindowCount--;
if (sWindowCount <= 1)
PostMessage(B_QUIT_REQUESTED);
break;
}
case EDIT_OPEN_FILE:
{
int32 index = 0;
entry_ref ref;
while (msg->FindRef("refs",index,&ref) == B_OK)
{
int32 line;
if (msg->FindInt32("line",index,&line) != B_OK)
line = -1;
int32 column;
if (msg->FindInt32("column",index,&column) != B_OK)
column = -1;
OpenFile(ref,line,column);
index++;
}
CheckCreateOpenPanel();
fOpenPanel->GetPanelDirectory(&ref);
gLastProjectPath.SetTo(ref);
BWindow* openWindow = fOpenPanel->Window();
break;
}
case M_FIND_AND_OPEN_FILE:
{
FindAndOpenFile(msg);
break;
}
case M_BUILDING_FILE:
{
SourceFile *file;
if (msg->FindPointer("sourcefile",(void**)&file) == B_OK)
printf(B_TRANSLATE("Building %s\n"),file->GetPath().GetFileName());
else
printf(B_TRANSLATE("NULL pointer in M_BUILDING_FILE\n"));
break;
}
case M_LINKING_PROJECT:
{
printf(B_TRANSLATE("Linking\n"));
break;
}
case M_UPDATING_RESOURCES:
{
printf(B_TRANSLATE("Updating resources\n"));
break;
}
case M_BUILD_FAILURE:
{
BString errstr;
if (msg->FindString("errstr",&errstr) == B_OK)
printf("%s\n",errstr.String());
else
{
ErrorList errors;
errors.Unflatten(*msg);
printf(B_TRANSLATE("Build failure\n%s"), errors.AsString().String());
}
sReturnCode = -1;
PostMessage(B_QUIT_REQUESTED);
break;
}
case M_BUILD_WARNINGS:
{
BString errstr;
if (msg->FindString("errstr",&errstr) == B_OK)
printf("%s\n",errstr.String());
break;
}
case M_BUILD_SUCCESS:
{
printf(B_TRANSLATE("Success\n"));
PostMessage(B_QUIT_REQUESTED);
break;
}
default:
BApplication::MessageReceived(msg);
}
}
示例6: GetPath
void
Project::Link(void)
{
BString linkString;
if (TargetType() == TARGET_STATIC_LIB)
{
linkString = "ar rcs '";
linkString << GetPath().GetFolder() << "/" << GetTargetName() << "' ";
for (int32 i = 0; i < CountGroups(); i++)
{
SourceGroup *group = GroupAt(i);
for (int32 j = 0; j < group->filelist.CountItems(); j++)
{
SourceFile *file = group->filelist.ItemAt(j);
if (file->GetObjectPath(fBuildInfo).GetFullPath())
linkString << "'" << file->GetObjectPath(fBuildInfo).GetFullPath() << "' ";
}
}
}
else
{
linkString = "gcc -o '";
linkString << GetPath().GetFolder() << "/" << GetTargetName() << "' ";
for (int32 i = 0; i < CountGroups(); i++)
{
SourceGroup *group = GroupAt(i);
for (int32 j = 0; j < group->filelist.CountItems(); j++)
{
SourceFile *file = group->filelist.ItemAt(j);
if (file->GetObjectPath(fBuildInfo).GetFullPath())
linkString << "'" << file->GetObjectPath(fBuildInfo).GetFullPath() << "' ";
}
}
for (int32 i = 0; i < CountGroups(); i++)
{
SourceGroup *group = GroupAt(i);
for (int32 j = 0; j < group->filelist.CountItems(); j++)
{
SourceFile *file = group->filelist.ItemAt(j);
if (file->GetLibraryPath(fBuildInfo).GetFullPath())
linkString << "'" << file->GetLibraryPath(fBuildInfo).GetFullPath() << "' ";
}
}
for (int32 i = 0; i < CountLibraries(); i++)
{
SourceFile *file = LibraryAt(i);
if (!file)
continue;
BString filenamebase;
filenamebase = file->GetPath().GetBaseName();
if (filenamebase.FindFirst("lib") == 0)
filenamebase.RemoveFirst("lib");
linkString << "-l" << filenamebase << " ";
}
if (TargetType() == TARGET_DRIVER)
linkString << "/boot/develop/lib/x86/_KERNEL_ ";
linkString << "-L/boot/home/config/lib ";
switch (TargetType())
{
case TARGET_DRIVER:
{
linkString << "-Xlinker -nostdlib ";
break;
}
case TARGET_SHARED_LIB:
{
linkString << "-nostart -Xlinker -soname=" << GetTargetName() << " ";
break;
}
default:
{
// Application
linkString << "-Xlinker -soname=_APP_ ";
break;
}
}
}
linkString << " 2>&1";
BString errmsg;
PipeCommand(linkString.String(),errmsg);
STRACE(1,("Linking %s:\n%s\nErrors:\n%s\n",GetName(),linkString.String(),errmsg.String()));
if (errmsg.CountChars() > 0)
ParseLDErrors(errmsg.String(),fBuildInfo.errorList);
//.........这里部分代码省略.........
示例7: temppath
void
Project::Save(const char *path)
{
BString projectPath = fPath.GetFolder();
projectPath << "/";
BString data;
data << "NAME=" << fName << "\nTARGETNAME=" << fTargetName << "\n";
data << "PLATFORM=" << sPlatformArray[fPlatform] << "\n";
switch (fSCMType)
{
case SCM_HG:
{
data << "SCM=hg\n";
break;
}
case SCM_GIT:
{
data << "SCM=git\n";
break;
}
case SCM_SVN:
{
data << "SCM=svn\n";
break;
}
case SCM_NONE:
{
data << "SCM=none\n";
break;
}
default:
{
break;
}
}
for (int32 i = 0; i < CountGroups(); i++)
{
SourceGroup *group = GroupAt(i);
data << "GROUP=" << group->name << "\n";
data << "EXPANDGROUP=" << (group->expanded ? "yes" : "no") << "\n";
for (int32 j = 0; j < group->filelist.CountItems(); j++)
{
SourceFile *file = group->filelist.ItemAt(j);
BString temppath(file->GetPath().GetFullPath());
if (temppath.FindFirst(projectPath.String()) == 0)
{
// Absolute paths which include the project folder are stripped
// down into relative paths
temppath.RemoveFirst(projectPath.String());
}
data << "SOURCEFILE=" << temppath << "\n";
if (file->GetDependencies() && strlen(file->GetDependencies()) > 0)
data << "DEPENDENCY=" << file->GetDependencies() << "\n";
}
}
for (int32 i = 0; i < fLocalIncludeList.CountItems(); i++)
data << "LOCALINCLUDE=" << fLocalIncludeList.ItemAt(i)->Relative() << "\n";
for (int32 i = 0; i < fSystemIncludeList.CountItems(); i++)
{
BString *string = fSystemIncludeList.ItemAt(i);
BString include = *string;
if (include[0] == '/')
include.RemoveFirst(projectPath.String());
data << "SYSTEMINCLUDE=" << include << "\n";
}
for (int32 i = 0; i < fLibraryList.CountItems(); i++)
{
SourceFile *file = (SourceFile*)fLibraryList.ItemAt(i);
if (!file)
continue;
BString strpath(file->GetPath().GetFullPath());
if (gPlatform == PLATFORM_ZETA)
{
if (strpath.FindFirst("/boot/beos/etc/develop/zeta-r1-gcc2-x86/") == 0)
strpath.ReplaceFirst("/boot/beos/etc/develop/zeta-r1-gcc2-x86/",
"/boot/develop/");
}
if (strpath.FindFirst(projectPath.String()) == 0)
strpath.RemoveFirst(projectPath.String());
data << "LIBRARY=" << strpath.String() << "\n";
}
data << "RUNARGS=" << fRunArgs << "\n";
data << "CCDEBUG=" << (fDebug ? "yes" : "no") << "\n";
data << "CCPROFILE=" << (fProfile ? "yes" : "no") << "\n";
data << "CCOPSIZE=" << (fOpSize ? "yes" : "no") << "\n";
data << "CCOPLEVEL=" << (int)fOpLevel << "\n";
data << "CCTARGETTYPE=" << fTargetType << "\n";
data << "CCEXTRA=" << fExtraCompilerOptions << "\n";
//.........这里部分代码省略.........
示例8: beide
status_t
BeIDE2Paladin(const char *path, BString &outpath)
{
status_t returnVal = BEntry(path).InitCheck();
if (returnVal != B_OK)
return returnVal;
BeIDEProject beide(path);
if (beide.InitCheck() != B_OK)
return beide.InitCheck();
DPath dpath(path);
Project proj(dpath.GetBaseName(), beide.TargetName());
proj.SetPlatform(PLATFORM_R5);
// NOTE: TARGET_* from Project.h & TARGET_* from BeIDEPRoject.h
// map perfectly, so no explicit conversion required
proj.SetTargetType(beide.TargetType());
BString savepath(dpath.GetFolder());
savepath << "/" << dpath.GetBaseName() << ".pld";
proj.Save(savepath.String());
for (int32 i = 0; i < beide.CountLocalIncludes(); i++)
{
BString include = beide.LocalIncludeAt(i);
if (include.ICompare("{project}") == 0)
continue;
include.RemoveFirst("{project}/");
proj.AddLocalInclude(include.String());
}
for (int32 i = 0; i < beide.CountSystemIncludes(); i++)
{
BString include = beide.SystemIncludeAt(i);
if (include.ICompare("{project}") == 0)
continue;
include.RemoveFirst("{project}/");
proj.AddSystemInclude(include.String());
}
SourceGroup *currentGroup = NULL;
for (int32 i = 0; i < beide.CountFiles(); i++)
{
ProjectFile file = beide.FileAt(i);
if (file.path.FindFirst("/_KERNEL_") > 0)
continue;
SourceFile *srcFile = gFileFactory.CreateSourceFileItem(file.path.String());
if (!srcFile)
continue;
if (dynamic_cast<SourceFileLib*>(srcFile))
{
proj.AddLibrary(srcFile->GetPath().GetFileName());
delete srcFile;
continue;
}
if (!proj.HasGroup(file.group.String()))
currentGroup = proj.AddGroup(file.group.String());
BPath newPath;
if (proj.LocateFile(srcFile->GetPath().GetFullPath(), newPath))
srcFile->SetPath(newPath.Path());
proj.AddFile(srcFile, currentGroup);
}
uint32 codeFlags = beide.CodeGenerationFlags();
if (codeFlags & CODEGEN_DEBUGGING)
proj.SetDebug(true);
if (codeFlags & CODEGEN_OPTIMIZE_SIZE)
proj.SetOpForSize(true);
proj.SetOpLevel(beide.OptimizationMode());
// Because Paladin doesn't currently support the seemingly 50,000 warning
// types, we'll put them in the compiler options for the ones not commonly
// used
BString options;
uint32 warnings = beide.Warnings();
if (warnings & WARN_STRICT_ANSI)
options << "-pedantic ";
if (warnings & WARN_LOCAL_SHADOW)
options << "-Wshadow ";
if (warnings & WARN_INCOMPATIBLE_CAST)
options << "-Wbad-function-cast ";
if (warnings & WARN_CAST_QUALIFIERS)
//.........这里部分代码省略.........
示例9: BMessage
ProjectWindow::ProjectWindow(BRect frame, Project *project)
: DWindow(frame, "Paladin", B_DOCUMENT_WINDOW, B_NOT_ZOOMABLE |
B_WILL_ACCEPT_FIRST_CLICK),
fErrorWindow(NULL),
fFilePanel(NULL),
fProject(project),
fSourceControl(NULL),
fShowingLibs(false),
fMenusLocked(false),
fBuilder(BMessenger(this))
{
AddCommonFilter(new AltTabFilter());
SetSizeLimits(200,30000,200,30000);
RegisterWindow();
// This is for our in-program debug menu which comes in handy now and then.
// Paladin -d doesn't always get the job done
AddShortcut('9', B_COMMAND_KEY | B_SHIFT_KEY | B_CONTROL_KEY,
new BMessage(M_TOGGLE_DEBUG_MENU));
if (fProject)
{
fSourceControl = GetSCM(fProject->SourceControl());
if (fSourceControl)
{
if (gPrintDebugMode > 0)
fSourceControl->SetDebugMode(true);
fSourceControl->SetUpdateCallback(SCMOutputCallback);
fSourceControl->SetWorkingDirectory(fProject->GetPath().GetFolder());
if (fSourceControl->NeedsInit(fProject->GetPath().GetFolder()))
fSourceControl->CreateRepository(fProject->GetPath().GetFolder());
}
}
BView *top = GetBackgroundView();
BRect bounds(Bounds());
BRect r(bounds);
r.bottom = 16;
fMenuBar = new BMenuBar(r,"documentbar");
top->AddChild(fMenuBar);
r = bounds;
r.top = fMenuBar->Frame().bottom + 1;
r.right -= B_V_SCROLL_BAR_WIDTH;
r.bottom -= B_H_SCROLL_BAR_HEIGHT;
fProjectList = new ProjectList(fProject, r,"filelist",B_FOLLOW_ALL);
fProjectList->SetInvocationMessage(new BMessage(M_EDIT_FILE));
BScrollView *scrollView = new BScrollView("scrollView",fProjectList,
B_FOLLOW_ALL,0,false,true);
top->AddChild(scrollView);
fProjectList->SetTarget(this);
r.top = r.bottom + 1;
r.bottom = Bounds().bottom;
fStatusBar = new BStringView(r,"statusbar", NULL, B_FOLLOW_LEFT_RIGHT |
B_FOLLOW_BOTTOM);
top->AddChild(fStatusBar);
fStatusBar->SetViewColor(235,235,235);
fStatusBar->SetFontSize(10.0);
SetupMenus();
if (project)
{
BString title("Paladin: ");
title << project->GetName();
SetTitle(title.String());
for (int32 i = 0; i < project->CountGroups(); i++)
{
SourceGroup *group = project->GroupAt(i);
SourceGroupItem *groupitem = new SourceGroupItem(group);
fProjectList->AddItem(groupitem);
groupitem->SetExpanded(group->expanded);
for (int32 j = 0; j < group->filelist.CountItems(); j++)
{
SourceFile *file = group->filelist.ItemAt(j);
SourceFileItem *fileitem = new SourceFileItem(file,1);
// fProjectList->AddUnder(fileitem,groupitem);
fProjectList->AddItem(fileitem);
BString abspath = file->GetPath().GetFullPath();
if (abspath[0] != '/')
{
abspath.Prepend("/");
abspath.Prepend(project->GetPath().GetFolder());
}
BEntry entry(abspath.String());
if (entry.Exists())
{
if (project->CheckNeedsBuild(file,false))
//.........这里部分代码省略.........
示例10: openmsg
//.........这里部分代码省略.........
fSourceControl->Push(NULL);
}
break;
}
case M_PULL_PROJECT:
{
if (fSourceControl)
{
SCMOutputWindow *win = new SCMOutputWindow(TR("Pull"));
win->Show();
status = fSourceControl->Pull(NULL);
if (!status)
ShowAlert("Unable to pull from the remote repository. If it "
"uses a secure connection, please set up the appropriate "
"SSH keys on the remote server.", "OK");
}
break;
}
case M_CULL_EMPTY_GROUPS:
{
CullEmptyGroups();
break;
}
case M_RUN_FILE_TYPES:
{
int32 selection = fProjectList->FullListCurrentSelection();
if (selection < 0)
break;
SourceFileItem *item = dynamic_cast<SourceFileItem*>(fProjectList->FullListItemAt(selection));
if (!item)
break;
SpawnFileTypes(item->GetData()->GetPath());
break;
}
case M_OPEN_PARENT_FOLDER:
{
BMessage openmsg(B_REFS_RECEIVED);
int32 selindex = 0;
int32 selection = fProjectList->FullListCurrentSelection();
selindex++;
if (selection >= 0)
{
while (selection >= 0)
{
SourceFileItem *item = dynamic_cast<SourceFileItem*>(fProjectList->FullListItemAt(selection));
if (!item)
break;
SourceFile *file = item->GetData();
BString abspath = file->GetPath().GetFullPath();
if (abspath[0] != '/')
{
abspath.Prepend("/");
abspath.Prepend(fProject->GetPath().GetFolder());
}
DPath filepath(abspath);
entry_ref ref;
BEntry(filepath.GetFolder()).GetRef(&ref);
openmsg.AddRef("refs",&ref);
selection = fProjectList->FullListCurrentSelection(selindex++);
}
示例11: partnerPath
void
ProjectWindow::ActOnSelectedFiles(const int32 &command)
{
SCMOutputWindow *win = NULL;
switch (command)
{
case M_ADD_SELECTION_TO_REPO:
{
if (!fSourceControl)
return;
win = new SCMOutputWindow(TR("Add to Repository"));
win->Show();
break;
}
case M_REMOVE_SELECTION_FROM_REPO:
{
if (!fSourceControl)
return;
win = new SCMOutputWindow(TR("Remove from Repository"));
win->Show();
break;
}
case M_REVERT_SELECTION:
{
if (!fSourceControl)
return;
win = new SCMOutputWindow(TR("Revert"));
win->Show();
break;
}
case M_DIFF_SELECTION:
{
if (!fSourceControl)
return;
win = new SCMOutputWindow(TR("Show Differences"));
win->Show();
break;
}
default:
break;
}
for (int32 i = 0; i < fProjectList->CountItems(); i++)
{
SourceFileItem *item = dynamic_cast<SourceFileItem*>(fProjectList->ItemAt(i));
if (item && item->IsSelected())
{
SourceFile *file = item->GetData();
BString relPath = file->GetPath().GetFullPath();
if (relPath.FindFirst(fProject->GetPath().GetFolder()) == 0)
{
relPath.RemoveFirst(fProject->GetPath().GetFolder());
relPath.RemoveFirst("/");
}
BString relPartnerPath;
entry_ref partnerRef = GetPartnerRef(file->GetPath().GetRef());
if (partnerRef.name)
{
DPath partnerPath(partnerRef);
relPartnerPath = partnerPath.GetFullPath();
if (relPartnerPath.FindFirst(fProject->GetPath().GetFolder()) == 0)
{
relPartnerPath.RemoveFirst(fProject->GetPath().GetFolder());
relPartnerPath.RemoveFirst("/");
}
}
switch (command)
{
case M_REBUILD_FILE:
{
if (file->UsesBuild())
{
file->RemoveObjects(*fProject->GetBuildInfo());
item->SetDisplayState(SFITEM_NEEDS_BUILD);
fProjectList->InvalidateItem(fProjectList->IndexOf(item));
}
break;
}
case M_ADD_SELECTION_TO_REPO:
{
fSourceControl->AddToRepository(relPath.String());
if (relPartnerPath.CountChars() > 0)
fSourceControl->AddToRepository(relPartnerPath.String());
break;
}
case M_REMOVE_SELECTION_FROM_REPO:
{
fSourceControl->RemoveFromRepository(relPath.String());
if (relPartnerPath.CountChars() > 0)
fSourceControl->RemoveFromRepository(relPartnerPath.String());
break;
}
case M_REVERT_SELECTION:
{
//.........这里部分代码省略.........