🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.opentoolsapi
6 messages
6 total messages Started by AlexB Sun, 04 May 2008 05:28
How to get full project path ?
#165
Author: AlexB
Date: Sun, 04 May 2008 05:28
12 lines
1078 bytes
Hi all.

Q1. I like to save a file in the project directory. How I can get the
full project path with OTA ?

Q2. What path is suitable for storing an IDE-related (not
project-related) files of the custom plugin ? How to get the full path
of that directory with OTA ?

TIA
-- 
Alex
Re: How to get full project path ?
#166
Author: Lex Y. Li
Date: Sun, 04 May 2008 11:39
12 lines
1458 bytes
> Q1. I like to save a file in the project directory. How I can get the
> full project path with OTA ?

You can get full path of the project file from IOTAProject.FileName. 
Then you can save files to the same folder of this project file.

> Q2. What path is suitable for storing an IDE-related (not
> project-related) files of the custom plugin ? How to get the full path
> of that directory with OTA ?

According to Vista rules, you should save files to a few recommended 
places. Then you don't need any OTA functions. Use Win32 API is enough.
Re: How to get full project path ?
#167
Author: AlexB
Date: Sun, 04 May 2008 12:10
25 lines
1674 bytes
Lex Y. Li wrote:

> > Q1. I like to save a file in the project directory. How I can get
> > the full project path with OTA ?
> 
> You can get full path of the project file from IOTAProject.FileName.
> Then you can save files to the same folder of this project file.

There is no such function/property in IOTAProject (at least I can't
find it in ToolsAPI.pas for RAD2007 and it's the reason why I'm asking
about it). Could you point out the exact interface ?

> > Q2. What path is suitable for storing an IDE-related (not
> > project-related) files of the custom plugin ? How to get the full
> > path of that directory with OTA ?
> 
> According to Vista rules, you should save files to a few recommended
> places. Then you don't need any OTA functions. Use Win32 API is
> enough.

It's true but I mainly ask about Studio IDE's special rules/conventions
(if any).

-- 
Alex 
Re: How to get full project path ?
#168
Author: Dennis Passmore
Date: Sun, 04 May 2008 21:01
38 lines
1884 bytes
uses
  Windows, Sysutils, ToolsAPI;

function GetProjectGroup: IOTAProjectGroup;
var
  IModuleServices: IOTAModuleServices;
  IModule: IOTAModule;
  i: Integer;
begin
  Assert(Assigned(BorlandIDEServices));

  IModuleServices := BorlandIDEServices as IOTAModuleServices;
  Assert(Assigned(IModuleServices));

  Result := nil;
  for i := 0 to IModuleServices.ModuleCount - 1 do
  begin
    IModule := IModuleServices.Modules[i];
    if IModule.QueryInterface(IOTAProjectGroup, Result) = S_OK then
      Break;
  end;
end;

function GetCurrentProjectName: string;
var
  Project: IOTAProject;
  ProjectGroup: IOTAProjectGroup;
begin
  Result := '';
  ProjectGroup := GetProjectGroup;
  if Assigned(ProjectGroup) then
  begin
    Project := ProjectGroup.ActiveProject;
    if Assigned(Project) then
      Result := Project.FileName;
  end;
end;
Re: How to get full project path ?
#170
Author: AlexB
Date: Mon, 05 May 2008 02:54
9 lines
930 bytes
Dennis Passmore wrote:

> function GetCurrentProjectName: string;

Looks slightly tricky, very helpful :-)
Thank you Dennis.

-- 
Alex
Re: How to get full project path ?
#171
Author: AlexB
Date: Mon, 05 May 2008 05:14
13 lines
1173 bytes
AlexB wrote:

> Lex Y. Li wrote:
> > You can get full path of the project file from IOTAProject.FileName.
 
> Could you point out the exact interface ?

Oh, I see now: IOTAProject is descendant of IOTAModule which contains
FileName property.

Thanks.
-- 
Alex
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads