CN112988161A - Method and device for constructing absolute path of compiled product and readable storage medium - Google Patents

Method and device for constructing absolute path of compiled product and readable storage medium Download PDF

Info

Publication number
CN112988161A
CN112988161A CN202110295107.3A CN202110295107A CN112988161A CN 112988161 A CN112988161 A CN 112988161A CN 202110295107 A CN202110295107 A CN 202110295107A CN 112988161 A CN112988161 A CN 112988161A
Authority
CN
China
Prior art keywords
path
target
file
compiled
absolute
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110295107.3A
Other languages
Chinese (zh)
Other versions
CN112988161B (en
Inventor
李立充
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Glodon Co Ltd
Original Assignee
Glodon Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Glodon Co Ltd filed Critical Glodon Co Ltd
Priority to CN202110295107.3A priority Critical patent/CN112988161B/en
Publication of CN112988161A publication Critical patent/CN112988161A/en
Application granted granted Critical
Publication of CN112988161B publication Critical patent/CN112988161B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method for constructing an absolute path of a compiled product, which can solve the technical problems of low efficiency and high error rate of manually counting the expected absolute path of the compiled product in the prior art, and comprises the following steps: receiving target path information, and determining a target project file according to the target path information; acquiring path information of a defined compilation product output directory in the target engineering file; when the path information of the compiled product output directory is a relative path, acquiring reference path variable parameters associated with the relative path, and assigning the reference path variable parameters according to the target path information; and constructing an absolute path of the compiled product according to the assigned reference path parameters. The invention also discloses a device for constructing the absolute path of the compiled product, a computer device and a computer readable storage medium.

Description

Method and device for constructing absolute path of compiled product and readable storage medium
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for constructing an absolute path of a compiled product, computer equipment and a computer readable storage medium.
Background
In the prior art, an engineering file is usually used to store program codes of all or part of functions of a certain product. Compiling the code in an engineering file may obtain a plurality of compiled products and absolute paths of the compiled products, where a compiled product may be an executable file, for example, the compiled product is an executable file of a software product or an executable file of a certain function of a software product.
In order to verify whether the compilation result is correct, it is generally required to determine an absolute path expected by the compilation product in advance and then compare the absolute path expected by the compilation product with the absolute path of the compilation product in the compilation result. In the existing related technology, engineering files need to be counted manually to determine an expected absolute path of a compiled product, and the method has the defects of low working efficiency and high error rate.
Aiming at the technical problems of low efficiency and high error rate of the absolute path expected by manual statistics of compiled products in the prior art, an effective solution is not provided at present.
Disclosure of Invention
The invention aims to provide a method, a device, computer equipment and a computer readable storage medium for constructing an absolute path of a compiled product, which can solve the technical problems of low efficiency and high error rate of manually counting the expected absolute path of the compiled product in the prior art.
One aspect of the present invention provides a method for constructing an absolute path of a compiled product, the method including: receiving target path information, and determining a target project file according to the target path information; acquiring path information of a defined compilation product output directory in the target engineering file; when the path information of the compiled product output directory is a relative path, acquiring reference path variable parameters associated with the relative path, and assigning the reference path variable parameters according to the target path information; and constructing an absolute path of the compiled product according to the assigned reference path parameters.
Optionally, the step of constructing an absolute path of the compiled product according to the assigned reference path arguments includes: determining an absolute path of the compiled product output directory according to the assigned reference path parameters; and constructing an absolute path of the compiled product according to the absolute path of the compiled product output directory.
Optionally, the step of constructing an absolute path of the compiled product according to the absolute path of the compiled product output directory includes: determining a name of the compiled product; acquiring the type of the defined compiling product in the target engineering file; determining an extension of the compiled artifact associated with the type of the compiled artifact; and constructing the absolute path of the compiled product according to the absolute path of the compiled product output directory, the name of the compiled product and the extension of the compiled product.
Optionally, the step of determining the name of the compiled product includes: judging whether the defined name of the compiled product exists in the target engineering file; when the defined name of the compiled product exists in the target project file, acquiring the name of the compiled product from the target project file; and when the name of the compiled product is not defined in the target engineering file, determining the name of the target engineering file as the name of the compiled product.
Optionally, the step of determining the target project file according to the target path information includes: acquiring an absolute path pointed by the target path information; determining the project files existing under the absolute path of the direction; when the project file is of a folder type, scanning all sub-project files related to the project file, and determining the sub-project file of the file type as the target project file; and when the project file is of a file type, determining the project file as the target project file.
Optionally, the step of assigning the reference path variable parameter according to the target path information includes: when the project file is of a folder type, determining target sub-project files of all folder types to which the target project file belongs from all the associated sub-project files; determining path information of a directory where each target sub-project file is currently located and path information of the directory where the target project file is currently located; when the determined path information is a relative path, determining an absolute path of a directory where the target engineering file is currently located according to the pointed absolute path, the path information of the directory where the target sub-engineering file is currently located and the path information of the directory where the target engineering file is currently located; and assigning the reference path variable parameters as the absolute path of the directory where the target engineering file is currently located.
Optionally, the step of assigning the reference path variable parameter according to the received target path information includes: when the project file is of a file type, extracting an absolute path of a directory where the project file is located from the pointed absolute path; and assigning the reference path variable parameters as the absolute path of the directory where the engineering file is currently located.
Another aspect of the present invention provides an apparatus for constructing an absolute path of a compiled product, the apparatus including: the receiving module is used for receiving the target path information and determining a target project file according to the target path information; the first acquisition module is used for acquiring path information of a defined compilation product output directory in the target engineering file; the second obtaining module is used for obtaining reference path variable parameters related to the relative path when the path information of the compiled product output directory is the relative path, and assigning the reference path variable parameters according to the target path information; and the construction module is used for constructing an absolute path of the compiled product according to the assigned reference path parameters.
Yet another aspect of the present invention provides a computer apparatus, comprising: the present invention relates to a method for constructing an absolute path of a compiled product, and more particularly, to a method for constructing an absolute path of a compiled product according to any one of the above embodiments.
Yet another aspect of the present invention provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the method for constructing an absolute path of a compiled product according to any one of the above embodiments.
The invention provides a method for constructing an absolute path of a compiled product, which determines a target engineering file according to received target path information, wherein the target engineering file is predefined with path information of a compiled product output directory, if the path information of the compiled product output directory is a relative path, reference path variable parameters used for converting the relative path into the absolute path are preset in the path information of the compiled product output directory, after the reference path variable parameters are assigned according to the received target path information, the assigned reference path variable parameters can be obtained, and the absolute path of the compiled product can be constructed further according to the assigned reference path variable parameters. In the embodiment, the reference path variable parameter is set in the path information of the compilation product output directory in advance, so that in the process of building the compilation product, the reference path variable parameter is assigned based on the received target path information, and then the absolute path of the compilation product is built according to the assigned reference path variable parameter, thereby realizing the technical effect of automatically building the absolute path of the compilation product, and overcoming the technical problems of low efficiency and high error rate of manually counting the expected absolute path of the compilation product in the prior art.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flow chart of a method for constructing an absolute path of a compiled product according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a construction scheme of an absolute path of a compiled product according to an embodiment of the present invention;
FIG. 3 is a block diagram of an apparatus for constructing an absolute path of a compiled product according to a second embodiment of the present invention;
fig. 4 is a block diagram of a computer device suitable for implementing a method for constructing an absolute path of a compiled product according to a third embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Example one
An absolute path refers to a path from a root directory at the top of a tree directory structure to a directory or a file, and is composed of a series of continuous directories, the middle of the directory is divided by oblique lines until the directory or the file is specified, and the last name in the path is the directory or the file to be pointed to. For example, in this embodiment, a current directory of a project file crl.pro is a CRL, and an absolute path of the current directory CRL is: e, HYCode/ghy/Art/Source/CRL, wherein the absolute path of the engineering file CRL. E, HYCode/ghy/Art/Source/CRL.
In this embodiment, path information of the compiled product output directory is predefined in the target project file, where the path information may be a relative path or an absolute path, and when the path information is a relative path, reference path arguments used for converting the relative path into the absolute path are preset, and the reference path arguments are assigned to convert the relative path into the absolute path, so as to obtain the absolute path of the compiled product output directory. The absolute path of the compiled product output directory may then be converted to an absolute path of the compiled product by determining a name of the compiled product and a suffix name of the compiled product.
It should be noted that the compiled product output directory defined in this embodiment is actually a directory to which the compiled product is expected to be output, and if the compiled product is actually output to the compiled product output directory after the compilation is completed, the compiled product output directory at this time may also be referred to as a directory where the compiled product is currently located.
Specifically, fig. 1 shows a flowchart of a method for constructing an absolute path of a compiled product according to a first embodiment of the present invention, and as shown in fig. 1, the method for constructing an absolute path of a compiled product may include steps S1 to S4, where:
and step S1, receiving the target path information, and determining the target project file according to the target path information.
The target path information is used to define an absolute path of a project document, and the target path information may be an absolute path including the project document, for example, the target path information is: the absolute path of the project file is: e, HYCode/ghy/Art/Source/CRL/CRL.pro; the method can also be directly an absolute path of the engineering file, for example, the target path information is E:/HYCode/ghy/Art/Source/CRL/crl.pro, which is not limited in this implementation as long as the target path information can define the absolute path of the engineering file.
Furthermore, an engineering file is positioned according to the target path information, and then the target engineering file is determined according to the type of the engineering file. Specifically, the step of determining the target project files according to the target path information in step S1 may include steps S11 to S14, in which:
step S11, obtaining the absolute path pointed by the target path information;
step S12, determining the project files existing in the absolute path of the direction;
step S13, when the project file is of folder type, scanning all the sub project files related to the project file, and determining the sub project file of file type as the target project file;
and step S14, when the project file is of the file type, determining the project file as the target project file.
It should be noted that the absolute path of a file only points to the file, and the absolute path of a directory only points to the directory. In this embodiment, the absolute path pointed by the target path information is the absolute path of the project file, and the absolute path only points to one project file. And acquiring the project file under the absolute path, and judging the type of the project file, wherein the type is divided into a file type and a folder type. If the type of the project file is the file type, the acquired project file is a target project file by default; if the type of the sub-project file is a folder type, the obtained sub-project file is associated with at least one sub-project file (each sub-project file is also called a project file, and in this embodiment, it is called a sub-project file for convenience of distinguishing), all the associated sub-project files are scanned, the type of each sub-project file is determined, and the sub-project file of each file type is marked as a target project file. In this case, there may be a plurality of target project files, and for each target project file, an absolute path of a compiled product may be constructed by the method described in the first embodiment.
Generally, a large software project may include hundreds of folders for storing project files of different functional modules, and each project file has an association relationship. For example, the physical distribution of folders is: \\ A \ B \ C \ D \ E \ F, the dependency relationship of the project files of all the folders is A- > B- > C- > D- > E- > F, namely the project files under the A folder depend on the project files under the B folder, and …, the project files under the E folder depend on the project files under the F folder. In the prior art, what the compiling result of the project file under the a folder is analyzed manually, B, C, D, E and F folders need to be opened in sequence, and the compiling result of the 5 project files is analyzed to obtain the actual compiling result of the project file under the a folder, so that the operation is very complicated. Moreover, if the dependency relationship is more complicated, it is more difficult for the manual analysis to determine the relationship between the engineering documents. Based on this, the embodiment distinguishes whether the project file is a folder type or a file type according to the type of the project file, only the project file of the file type has the path information of the compiled product output directory, and for the project file of the folder type, the sub-project files are traversed, the types of the sub-project files are continuously judged, and the sub-project file of the file type is determined to be the target project file, that is, the embodiment can quickly and accurately distinguish the dependency relationship of the project file based on the type of the project file.
It should be noted that the engineering file may be a QT engineering file, and accordingly, the target engineering file may be a target QT engineering file, and the sub-engineering file may be a QT sub-engineering file, where each QT sub-engineering file is also a QT engineering file, and may be referred to as a QT sub-engineering file for convenience of distinction.
Step S2, obtaining path information of the compiled product output directory defined in the target project file. If the path information of the compilation product output directory is a relative path, the absolute path of the target project file is taken as a reference path.
As can be seen from the above description, the target engineering file is a file type, path information of the compilation product output directory is defined therein, and when the path information is a relative path, reference path arguments for converting the relative path into an absolute path are preset in the path information of the compilation product output directory. Alternatively, the path information of the compilation product output directory may further include offset number information for defining an offset number and offset path information for defining an offset path, the reference path may be determined by the reference path argument and the offset number defined by the offset number information, and the absolute path of the compilation product output directory may be determined by the reference path and the offset path defined by the offset path information.
For example, the path information of the compiled-product output directory is $ PWD/./Release/Bin/X86, $ PWD is the reference path parameter, and./is the offset amount information, from which it can be known that the offset amount is 2, Release/Bin/X86 is the offset path information, and the offset path information at this time is the offset path. Assuming that the argument is assigned to the reference path as E:/HYCode/ghy/Art/Source/CRL, since the offset number is 2, the reference path is E:/HYCode/ghy/Art, and the absolute path of the compiled-product output directory is E:/HYCode/ghy/Art/Release/Bin/X86.
And step S3, when the path information of the compiled product output directory is a relative path, acquiring reference path variable parameters associated with the relative path, and assigning values to the reference path variable parameters according to the target path information.
Since the absolute path of the compiled product is determined by the absolute path of the compiled product output directory, the name of the compiled product, and the extension of the compiled product, and the path information of the compiled product output directory is a relative path at this time, a value needs to be assigned to the reference path variable parameter to determine the absolute path of the compiled product output directory. Further, since the path information of the compilation product output directory is stored in the target project file, the path information of the compilation product output directory takes the absolute path of the directory where the target project file is currently located as the reference path, and at this time, the absolute path of the directory where the target project file is currently located needs to be given as the reference path variable parameter.
Specifically, in an embodiment, if the determined engineering file is the target engineering file, the absolute path pointed by the target path information is the absolute path of the target engineering file, the absolute path of the directory where the engineering file is currently located is extracted from the pointed absolute path, and the absolute path is assigned to the reference path variable parameter. That is, the step of assigning the reference path variable value according to the target path information in step S3 may include step S31 and step S32, in which:
step S31, when the attribute of the project file is the file type, extracting the absolute path of the directory where the project file is currently located from the pointed absolute path;
and step S32, assigning the reference path change parameter as an absolute path of the directory where the project file is currently located.
For example, the absolute path of the pointing is: e, HYCode/ghy/Art/Source/CRL/CRL.pro, wherein the absolute path of the current directory of the engineering file is as follows: E:/HYCode/ghy/Art/Source/CRL.
In another embodiment, if a certain sub-project file associated with the determined project file is a target project file, an absolute path of a directory where the target project file is currently located needs to be determined according to the pointed absolute path, and the absolute path is assigned to the reference path variable parameter. That is, the step of assigning the reference path variable parameter according to the target path information in step S3 may include steps S31 'to S33', in which:
step S31', when the project file is of folder type, determining the target sub project file of all folder types to which the target project file belongs from all the associated sub project files;
step S32', determining the path information of the current directory of each target sub-project file and the path information of the current directory of the target project file;
step S33', when each determined path information is a relative path, determining the absolute path of the directory where the target project file is currently located according to the pointed absolute path, the path information of the directory where each target sub project file is currently located and the path information of the directory where the target project file is currently located;
and step 34', assigning the reference path change parameter as the absolute path of the directory where the target project file is currently located.
When the determined path information is a relative path, the path information of the directory where the target sub-project file is currently located is also called a relative path of the directory where the target sub-project file is currently located, and the path information of the directory where the target project file is currently located is also called a relative path of the directory where the target project file is currently located.
Specifically, when the project file is of a folder type, the project file stores relative paths of the directory where all the sub-project files of the next level are currently located, and the relative paths are realized based on absolute paths of the project file; if the sub-project file of the next level is of a folder type, the sub-project file stores relative paths of directories where all sub-project files of the next level are currently located, the relative paths of the next level are realized based on the absolute paths of the sub-project files of the next level, …, and the like. Further, determining target sub-engineering files of all folder types to which the target engineering file belongs, determining the absolute path of the current directory of the sub-engineering file of the next higher-level folder type next to the target engineering file according to the relative path and the directed absolute path of the current directory of the target sub-engineering file, determining the absolute path of the current directory of the target engineering file by combining the relative path of the current directory of the target engineering file, and assigning the absolute path to the reference path variable parameter.
For example, the absolute path of the project file 1 is D:/ghy/Source/WGH/UGF.pro, the next level of the project file 1 has two folder type sub-project files 11 and 12, the next level of the sub-project file 12 has one folder type sub-project file 121, and the next level of the sub-project file 121 has one file type sub-project file 1211 (i.e., target sub-project file). The project file 1 stores the relative path of the directory where the sub-project file 11 is currently located and the relative path of the directory where the sub-project file 12 is currently located, the sub-project file 12 stores the relative path of the directory where the sub-project file 121 is currently located, and the sub-project file 121 stores the relative path of the directory where the sub-project file 1211 is currently located. The target sub-project files to which the sub-project file 1211 belongs are the sub-project file 12 and the sub-project file 121. According to the pointed absolute path, the relative path of the directory where the sub-project file 12 is currently located, and the relative path of the directory where the sub-project file 121 is currently located, the absolute path of the directory where the sub-project file 121 is currently located can be determined, where the sub-project file 121 is a sub-project file of a folder type at the upper level next to the sub-project file 1211. Further, according to the absolute path of the directory where the sub-project file 121 is currently located and the relative path of the directory where the sub-project file 1211 is currently located, the absolute path of the directory where the sub-project file 1211 is currently located can be determined, and then the absolute path is assigned to the reference path variable parameter.
And step S4, constructing an absolute path of the compiled product according to the assigned reference path parameters.
Specifically, step S4 may include step S41 and step S42, wherein:
step S41, determining an absolute path of the compiled product output directory according to the assigned reference path parameters;
and step S42, constructing the absolute path of the compiled product according to the absolute path of the compiled product output catalog.
The reference path is subjected to variable parameter assignment to obtain a reference path, then the reference path is subjected to progressively reduced offset quantity directories from the lowest level to the highest level to obtain a reference path, the reference path and the offset path are combined to obtain an absolute path of a compiled product output directory, and further the absolute path of the compiled product is constructed according to the absolute path of the compiled product output directory.
Specifically, step S42 may include steps S421 to S424, where:
step S421, determining the name of the compiled product;
step S422, acquiring the type of the compiled product defined in the target project file;
step S423, determining an extension of the compiled product associated with the type of the compiled product;
step S424, construct the absolute path of the compiled product according to the absolute path of the compiled product output directory, the name of the compiled product, and the extension of the compiled product.
If the name of the compiled product is defined in the target engineering file, the name can be directly obtained; if not defined, the name of the target project file may be determined as the name of the compilation product. Specifically, step S421 may include steps S4211 to S4213:
step S4211, judging whether the defined name of the compiled product exists in the target project file;
step S4212, when the defined name of the compiled product exists in the target project file, obtaining the name of the compiled product from the target project file;
step S4213, when the name of the compiled product is not defined in the target engineering file, determining the name of the target engineering file as the name of the compiled product.
Optionally, the type of the compiled product is predefined in the target engineering file, each type is associated with an extension in advance, the extension of the compiled product can be known through the type of the compiled product, and then the absolute path of the compiled product can be constructed according to the absolute path of the output directory of the compiled product, the name of the compiled product, and the extension of the compiled product.
For example, the absolute path of the compilation product output directory is E:/HYCode/ghy/Art/Release/Bin/X86, the name of the compilation product is CRL, the type of the compilation product is lib, and the associated extension name is dll, and the absolute path of the constructed compilation product is: e, the method comprises the steps of A, E, and E, wherein the method comprises the steps of A, E, HYCode, ghy, Art, Release, Bin, X86, CRL, dll; if the other information is the same, but the type of the compiled product is app, the associated extension is exe, and the absolute path of the constructed compiled product is: e: \ \ HYCode \ \ ghy \ \ Art \ \ Release \ \ Bin \ \ X86\ \ CRL.exe.
The following describes the construction process of the absolute path of the compiled product of the present invention in detail by using a specific example.
As shown in fig. 2, the user inputs an absolute path of a project document, and uniquely determines the project document according to the absolute path. And analyzing the project file, judging whether the project file is of a file type or a folder type, and if the project file is of the folder type, scanning all the associated sub-project files until the sub-project file (namely the target project file) of the file type is determined. And if the file type is the file type, the engineering file which is uniquely determined according to the absolute path is the target engineering file. And analyzing the information in the target project file to judge the extension of the edited product, and specifically determining the extension according to the type of the edited product. Then assigning a reference path variable parameter (namely $ PWD macro definition) to convert the reference path variable parameter into an absolute path of a directory where the target engineering file is located currently, determining an absolute path of a compilation product output directory according to the assigned reference path variable parameter, and constructing the absolute path of the compilation product: and the absolute path of the compiled product output directory + the name of the compiled product + the extension of the compiled product, and storing the constructed absolute path of the compiled product in a data table.
Example two
The second embodiment of the present invention further provides a device for constructing an absolute path of a compiled product, where the device for constructing an absolute path of a compiled product corresponds to the method for constructing an absolute path of a compiled product provided in the first embodiment, and corresponding technical features and technical effects are not described in detail in this embodiment, and reference may be made to the first embodiment for relevant points. Specifically, fig. 3 shows a block diagram of a device for constructing an absolute path of a compiled product according to the second embodiment of the present invention. As shown in fig. 3, the apparatus 300 for constructing an absolute path of a compiled product may include a receiving module 301, a first obtaining module 302, a second obtaining module 303, and a constructing module 304, wherein:
a receiving module 301, configured to receive target path information, and determine a target project file according to the target path information;
a first obtaining module 302, configured to obtain path information of a compiled product output directory defined in the target engineering file;
a second obtaining module 303, configured to, when the path information of the compiled product output directory is a relative path, obtain a reference path variable parameter associated with the relative path, and assign a value to the reference path variable parameter according to the target path information;
and the building module 304 is used for building an absolute path of the compiled product according to the assigned reference path parameters.
Optionally, the building module further comprises: the first determining unit is used for determining an absolute path of the compiled product output directory according to the assigned reference path parameters; and the construction unit is used for constructing the absolute path of the compiled product according to the absolute path of the compiled product output directory.
Optionally, the construction unit is further configured to: determining a name of the compiled product; acquiring the type of the defined compiling product in the target engineering file; determining an extension of the compiled artifact associated with the type of the compiled artifact; and constructing the absolute path of the compiled product according to the absolute path of the compiled product output directory, the name of the compiled product and the extension of the compiled product.
Optionally, when the step of determining the name of the compiled product is executed, the constructing unit is further configured to: judging whether the defined name of the compiled product exists in the target engineering file; when the defined name of the compiled product exists in the target project file, acquiring the name of the compiled product from the target project file; and when the name of the compiled product is not defined in the target engineering file, determining the name of the target engineering file as the name of the compiled product.
Optionally, when the receiving module executes the step of determining the target project file according to the target path information, the receiving module includes: an obtaining unit, configured to obtain an absolute path to which the target path information points; the second determining unit is used for determining the project files existing under the absolute path of the direction; a third determining unit, configured to scan all sub-project files associated with the project file when the project file is of a folder type, and determine a sub-project file of a file type as the target project file; and the fourth determining unit is used for determining the project file as the target project file when the project file is of a file type.
Optionally, when the step of assigning the reference path variable parameter according to the target path information is executed by the second obtaining module, the step of assigning the reference path variable parameter according to the target path information includes: a fifth determining unit, configured to determine, when the project file is of a folder type, a target sub-project file of all folder types to which the target project file belongs from all the associated sub-project files; a sixth determining unit, configured to determine path information of a directory where each target sub-project file is currently located and path information of the directory where the target project file is currently located; a seventh determining unit, configured to determine, when each determined path information is a relative path, an absolute path of a directory where the target engineering file is currently located according to the pointed absolute path, the path information of the directory where each target sub-engineering file is currently located, and the path information of the directory where the target engineering file is currently located; and the first assignment unit is used for assigning the reference path variable parameters as the absolute path of the directory where the target engineering file is currently located.
Optionally, when the second obtaining module performs the step of assigning the reference path variable parameter according to the target path information, the second obtaining module further includes: the extraction unit is used for extracting the absolute path of the directory where the engineering file is currently located from the pointed absolute path when the engineering file is of the file type; and the second assignment unit is used for assigning the reference path variable parameters to be absolute paths of the current directory of the engineering files.
EXAMPLE III
Fig. 4 is a block diagram of a computer device suitable for implementing a method for constructing an absolute path of a compiled product according to a third embodiment of the present invention. In this embodiment, the computer device 400 may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster composed of a plurality of servers), and the like that execute programs. As shown in fig. 4, the computer device 400 of the present embodiment includes at least, but is not limited to: a memory 401, a processor 402, a network interface 403 communicatively coupled to each other via a system bus. It is noted that FIG. 4 only shows the computer device 400 having components 401 and 403, but it is understood that not all of the shown components are required and that more or fewer components may be implemented instead.
In this embodiment, the memory 403 includes at least one type of computer-readable storage medium, which includes flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 401 may be an internal storage unit of the computer device 400, such as a hard disk or a memory of the computer device 400. In other embodiments, the memory 401 may also be an external storage device of the computer device 400, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the computer device 400. Of course, the memory 401 may also include both internal and external storage devices for the computer device 400. In the present embodiment, the memory 401 is generally used to store an operating system installed in the computer apparatus 400 and various types of application software, such as program codes of a construction method of an absolute path of a compiled product, and the like.
Processor 402 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 402 is generally used to control the overall operation of the computer device 400. Such as performing control and processing related to data interaction or communication with computer device 400. In this embodiment, the processor 402 is configured to execute the program code of the step of the method for constructing the absolute path of the compiled product stored in the memory 401.
In this embodiment, the method for constructing the absolute path of the compiled product stored in the memory 401 may be further divided into one or more program modules and executed by one or more processors (in this embodiment, the processor 402) to implement the present invention.
The network interface 403 may comprise a wireless network interface or a wired network interface, the network interface 403 typically being used to establish communication links between the computer device 400 and other computer devices. For example, the network interface 403 is used to connect the computer apparatus 400 with an external terminal through a network, establish a data transmission channel and a communication link between the computer apparatus 400 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth (Bluetooth), or Wi-Fi.
Example four
The present embodiment also provides a computer-readable storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application mall, etc., on which a computer program is stored, which when executed by a processor, implements the steps of the method of constructing the absolute path of the compilation product.
It will be apparent to those skilled in the art that the modules or steps of the embodiments of the invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, embodiments of the invention are not limited to any specific combination of hardware and software.
It should be noted that the numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A method for constructing an absolute path of a compiled product, the method comprising:
receiving target path information, and determining a target project file according to the target path information;
acquiring path information of a defined compilation product output directory in the target engineering file;
when the path information of the compiled product output directory is a relative path, acquiring reference path variable parameters associated with the relative path, and assigning the reference path variable parameters according to the target path information;
and constructing an absolute path of the compiled product according to the assigned reference path parameters.
2. The method of claim 1, wherein the step of constructing an absolute path of the compiled product from the assigned reference path arguments comprises:
determining an absolute path of the compiled product output directory according to the assigned reference path parameters;
and constructing an absolute path of the compiled product according to the absolute path of the compiled product output directory.
3. The method of claim 2, wherein the step of constructing the absolute path of the compiled product from the absolute path of the compiled product output directory comprises:
determining a name of the compiled product;
acquiring the type of the defined compiling product in the target engineering file;
determining an extension of the compiled artifact associated with the type of the compiled artifact;
and constructing the absolute path of the compiled product according to the absolute path of the compiled product output directory, the name of the compiled product and the extension of the compiled product.
4. The method of claim 3, wherein the step of determining the name of the compiled product comprises:
judging whether the defined name of the compiled product exists in the target engineering file;
when the defined name of the compiled product exists in the target project file, acquiring the name of the compiled product from the target project file;
and when the name of the compiled product is not defined in the target engineering file, determining the name of the target engineering file as the name of the compiled product.
5. The method of claim 1, wherein the step of determining a target project file from the target path information comprises:
acquiring an absolute path pointed by the target path information;
determining the project files existing under the absolute path of the direction;
when the project file is of a folder type, scanning all sub-project files related to the project file, and determining the sub-project file of the file type as the target project file;
and when the project file is of a file type, determining the project file as the target project file.
6. The method of claim 5, wherein the step of assigning the reference path variable according to the target path information comprises:
when the project file is of a folder type, determining target sub-project files of all folder types to which the target project file belongs from all the associated sub-project files;
determining path information of a directory where each target sub-project file is currently located and path information of the directory where the target project file is currently located;
when the determined path information is a relative path, determining an absolute path of a directory where the target engineering file is currently located according to the pointed absolute path, the path information of the directory where the target sub-engineering file is currently located and the path information of the directory where the target engineering file is currently located;
and assigning the reference path variable parameters as the absolute path of the directory where the target engineering file is currently located.
7. The method of claim 5, wherein the step of assigning the reference path variable according to the target path information comprises:
when the project file is of a file type, extracting an absolute path of a directory where the project file is located from the pointed absolute path;
and assigning the reference path variable parameters as the absolute path of the directory where the engineering file is currently located.
8. An apparatus for constructing an absolute path of a compiled product, the apparatus comprising:
the receiving module is used for receiving the target path information and determining a target project file according to the target path information;
the first acquisition module is used for acquiring path information of a defined compilation product output directory in the target engineering file;
the second obtaining module is used for obtaining reference path variable parameters related to the relative path when the path information of the compiled product output directory is the relative path, and assigning the reference path variable parameters according to the target path information;
and the construction module is used for constructing an absolute path of the compiled product according to the assigned reference path parameters.
9. A computer device, the computer device comprising: memory, processor and computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1 to 7.
CN202110295107.3A 2021-03-19 2021-03-19 Method and device for constructing absolute path of compiled product and readable storage medium Active CN112988161B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110295107.3A CN112988161B (en) 2021-03-19 2021-03-19 Method and device for constructing absolute path of compiled product and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110295107.3A CN112988161B (en) 2021-03-19 2021-03-19 Method and device for constructing absolute path of compiled product and readable storage medium

Publications (2)

Publication Number Publication Date
CN112988161A true CN112988161A (en) 2021-06-18
CN112988161B CN112988161B (en) 2024-05-28

Family

ID=76333773

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110295107.3A Active CN112988161B (en) 2021-03-19 2021-03-19 Method and device for constructing absolute path of compiled product and readable storage medium

Country Status (1)

Country Link
CN (1) CN112988161B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070011494A1 (en) * 2005-06-21 2007-01-11 International Business Machines Corporation System and method for building software package for embedded system
US20070055963A1 (en) * 2005-09-08 2007-03-08 Lucent Technologies, Inc. Compile target and compiler flag extraction in program analysis and transformation systems
CN109358841A (en) * 2018-08-15 2019-02-19 中国平安人寿保险股份有限公司 Web application develops Compilation Method, device and storage equipment, computer equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070011494A1 (en) * 2005-06-21 2007-01-11 International Business Machines Corporation System and method for building software package for embedded system
US20070055963A1 (en) * 2005-09-08 2007-03-08 Lucent Technologies, Inc. Compile target and compiler flag extraction in program analysis and transformation systems
CN109358841A (en) * 2018-08-15 2019-02-19 中国平安人寿保险股份有限公司 Web application develops Compilation Method, device and storage equipment, computer equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
徐学辉;: "浅谈网站建设中相对路径与绝对路径的使用", 中国科技信息, no. 03 *

Also Published As

Publication number Publication date
CN112988161B (en) 2024-05-28

Similar Documents

Publication Publication Date Title
CN108958714B (en) Business component type development method and device, computer equipment and storage medium
CN110704521A (en) Interface data access method and system
CN110928802A (en) Test method, device, equipment and storage medium based on automatic generation of case
CN111191079B (en) Document content acquisition method, device, equipment and storage medium
CN110727526B (en) Method and system for processing big data computing task
CN110175157B (en) Query method and query device for column storage file
CN110806866A (en) Generation method and device of front-end management system
CN106557419B (en) Program testing method and device
CN111522583A (en) Method and device for generating configuration file, computer equipment and storage medium
CN112988161B (en) Method and device for constructing absolute path of compiled product and readable storage medium
CN111026047B (en) Software configuration method and device
CN111475165A (en) Intelligent compiling method, system, terminal and storage medium for application program
CN114143322B (en) Configuration action evaluation method for computing resources in hybrid cloud scene
CN114817152A (en) Method and system for querying slice file
CN111274128A (en) Test method, test device, computer equipment and computer readable storage medium
CN111563038A (en) SDK test method, device, computer equipment and computer readable storage medium
CN114328181A (en) Test case generation and execution method, device and storage medium
CN114511314A (en) Payment account management method and device, computer equipment and storage medium
CN111737316A (en) Engineering list query method and device, computer equipment and storage medium
CN113076365A (en) Data synchronization method and device, electronic equipment and storage medium
CN114253595A (en) Code warehouse management method and device, computer equipment and storage medium
CN117540704B (en) Data reverse perspective conversion method, device, equipment and medium of data table
CN113378519A (en) Text export method, system, computer device and computer readable storage medium
CN111144086B (en) Log formatting method and device, electronic equipment and storage medium
CN109344210B (en) Grid correction method and device and terminal equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant