Code Monkey home page Code Monkey logo

Comments (7)

shanzhashu avatar shanzhashu commented on May 25, 2024

CnOtaGetCurrentProjectFileName照理拿到的就是当前工程的文件,是否有问题?

from cnwizards.

KngStr avatar KngStr commented on May 25, 2024

现在是这样的,如果我有一个工程组,在工程组编译的时候,取到的就会是当前激活的工程
但我现在需要取的是正在编译的工程。
例如:
我有一个工程组:

group1
dpr1(激活)
dpr2

如果我直接在group1上面右键 build,那么CnOtaGetCurrentProjectFileName得到的始终就是dpr1
但我需要的是当前正在build的那个project

from cnwizards.

shanzhashu avatar shanzhashu commented on May 25, 2024

这个有点麻烦,CnOtaGetCurrentProjectFileName以及相关的OTA接口的确拿到的就是“激活”的工程,而不管当前Build的是什么。
我研究一下有无其他接口以知道当前正在build的是啥工程。

from cnwizards.

KngStr avatar KngStr commented on May 25, 2024

辛苦了,非常感谢

from cnwizards.

shanzhashu avatar shanzhashu commented on May 25, 2024

脚本专家里添加了一个函数:function GetCurrentCompilingProject: IOTAProject;
可用试一试,还不确定是否能准确使用。

from cnwizards.

shanzhashu avatar shanzhashu commented on May 25, 2024

915版本已支持此函数。

from cnwizards.

KngStr avatar KngStr commented on May 25, 2024

谢谢,测试OK。
附上我测试的脚本

{*******************************************************}
{                                                       }
{       Pascal Script Source File                       }
{       Run by RemObjects Pascal Script in CnWizards    }
{                                                       }
{       Generated by CnPack IDE Wizards                 }
{                                                       }
{*******************************************************}

program CompileTime;

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

procedure GenCompInt(S: String);
var
  CompileTime: string;
begin
  CompileTime := '';
  CompileTime := CompileTime + '// Author    : KngStr' + #13#10;
  CompileTime := CompileTime + '// Link      : http://www.kngstr.com/?compiletime' + #13#10;

  CompileTime := CompileTime + '// Compiler  : ' + CompilerName + #13#10;

  CompileTime := CompileTime + '// Useage    : ' + #13#10;
  CompileTime := CompileTime + '//   FormatCompileTime(''yyyymmddhhnn'')' + #13#10;
  CompileTime := CompileTime + 'const ' + #13#10 +
    '  CompileTime = ' + FloatToStr(Now) + ';' + #13#10 +
    '  CompileTimeInt = ' + FormatDateTime('yyyymmddhhnnss', Now) + ';' + #13#10#13#10;

  CompileTime := CompileTime + 'function FormatCompileTime(const Format: string): string;' + #13#10;
  CompileTime := CompileTime + 'begin' + #13#10 +
                  '  Result := FormatDateTime(Format, CompileTime);' + #13#10 +
                  'end;' + #13#10;

  SaveStringToFile(CompileTime, S + 'CompileTime.inc');
end;

var
  Project: IOTAProject;
begin
  if GetCurrentCompilingProject <> nil then
    Project := GetCurrentCompilingProject
  else if CnOtaGetCurrentProject <> nil then
    Project := CnOtaGetCurrentProject
  else
    Exit;

  GenCompInt(ExtractFilePath(Project.GetFileName));
end.

from cnwizards.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.