Skip to content

Support getfilePath api and handle same function identifier #51

@boy1583

Description

@boy1583

We used bin2cpp to process our SPA single page application resources in a folder (html\css\js).

We have two issues.

  1. For the generation method in a folder, we can‘t get the path of the original file. So we created a new API called getFilePath in File class.
    E.g:
virtual const char * getFilename() const { return "app.4581e082.css"; }
virtual const char * getFilepath() const { return "static/css/app.4581e082.css"; }
  1. call GetFilenameWithoutExtension double times in processInputDirectory, which causes the following files to be overwritten (both a.h):
static/js/A.123.js
static/css/A.456.css

We remove one GetFilenameWithoutExtension call in getFunctionIdentifierFromPath.

  1. The following situation may lead to ths same function identifier (e.g. class A123), leading to compilation errors (redeclaration)
static/js/A.123.js
static/css/A.123.css

We use a map to save identifier times, which is solved by appending increase index, such as class A123_1 and class A123_2, although it is not very elegant.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions