File processing method and device, computer equipment, storage medium and program product

By detecting and deleting deletable resources in the reference relationship chain of the target resource in the installation file, the problem of insufficient reduction of installation files in the existing technology is solved, and more efficient reduction of installation file resources is achieved.

CN119473321APending Publication Date: 2025-02-18TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311015583.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-10
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

When the prior art reduces installation files, the efforts are insufficient and cannot effectively improve the resource reduction efforts of installation files.

Method used

By receiving the resource deletion request for the installation file, obtain the reference relationship chain of the target resource, detect the resource reference status on the reference relationship chain, determine the deletion resource, and reduce the installation file based on the target resource and deletion resource.

Benefits of technology

It realizes more comprehensive reduction of installation files and improves the resource reduction of installation files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473321A_ABST
    Figure CN119473321A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a file processing method and device, computer equipment, a storage medium and a program product. The file processing method comprises the steps of receiving a resource deletion request of an installation file; the resource deletion request is used for requesting to delete a target resource in the installation file; obtaining a reference relation chain of the target resource, wherein the reference relation chain comprises one-level or multi-level resources referenced by the target resource; detecting the resource reference condition of each resource on the reference relation chain, and determining deletable resources in the reference relation chain according to a detection result; the deletable resources are resources which are not referenced by other resources except the reference relationship chain in the reference relationship chain, or resources which are referenced by other resources except the reference relationship chain but are not referenced by other resources in the reference relationship chain; and according to the target resource and the deletable resource, performing reduction processing on the installation file. By adopting the embodiment of the invention, the installation file can be reduced more comprehensively, and the resource reduction strength of the installation file is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a file processing method, a file processing device, a computer equipment, a computer-readable storage medium, and a computer program product. Background Art

[0002] With the continuous development of computer technology, various business products are installed in terminals by business objects for use; for example, business objects install payment business products for payment processing, business objects install audio and video on demand business products for audio and video on demand, business objects install game business products for game playing, etc. Business products are installed by their corresponding installation files (or installation packages), and the size of the installation files is related to the usage of their corresponding business products; for example, the smaller the size of the installation files of business products of the same type, the stronger the willingness of business objects to spend traffic to download the installation files; for another example, when the terminal memory space is insufficient, the larger the size of the installation files, the greater the possibility that the corresponding business products will be cleared.

[0003] It can be seen that, to a certain extent, reducing the installation files (or reducing the installation packages) can have a positive impact on the usage of the business products corresponding to the installation files. At present, the reduction solution for security files is to delete resources that are not referenced in the installation files or to delete resources that are requested to be deleted in the installation files. However, only deleting resources that are not referenced in the installation files or resources that are requested to be deleted is far from enough to reduce the installation files. Therefore, how to improve the reduction of installation files has become a current research hotspot. Summary of the invention

[0004] The embodiments of the present application provide a file processing method, apparatus, computer equipment, storage medium, and program product, which can perform more comprehensive reduction processing on installation files and enhance the resource reduction of installation files.

[0005] On the one hand, an embodiment of the present application provides a file processing method, the file processing method comprising:

[0006] Receive a resource deletion request for an installation file; the installation file is used to install a business product, the installation file includes multiple resources, and the resource deletion request is used to request deletion of a target resource in the installation file;

[0007] Obtain the reference relationship chain of the target resource, which includes the primary or multi-level resources referenced by the target resource; the primary or multi-level resources referenced by the target resource refer to the resources in the installation file that use the target resource as the reference starting point and have a primary or multi-level reference relationship with the target resource;

[0008] Detect the resource reference status of each resource on the reference relationship chain, and determine the deletable resources in the reference relationship chain according to the detection results; the deletable resources refer to the resources in the reference relationship chain that are not referenced by other resources except the reference relationship chain, or the resources in the reference relationship chain that are referenced by other resources except the reference relationship chain but are not referenced by other resources;

[0009] The installation files are reduced based on the target resources and the deletable resources.

[0010] Accordingly, an embodiment of the present application provides a file processing device, which includes:

[0011] An acquisition unit is used to receive a resource deletion request of an installation file; the installation file is used to install a business product, the installation file includes multiple resources, and the resource deletion request is used to request deletion of a target resource in the installation file;

[0012] The acquisition unit is further used to acquire a reference relationship chain of the target resource, the reference relationship chain including one or more levels of resources referenced by the target resource; the one or more levels of resources referenced by the target resource refer to resources in the installation file that use the target resource as a reference starting point and have one or more levels of reference relationships with the target resource;

[0013] A processing unit, used to detect resource references of each resource on the reference relationship chain, and determine deletable resources in the reference relationship chain according to the detection result; deletable resources refer to resources in the reference relationship chain that are not referenced by other resources except the reference relationship chain, or resources in the reference relationship chain that are referenced by other resources except the reference relationship chain but are not referenced by other resources;

[0014] The processing unit is further used to reduce the installation files according to the target resources and the deletable resources.

[0015] In one implementation, the processing unit is used to detect resource references of each resource in the reference relationship chain, and when a deletable resource is determined in the reference relationship chain according to the detection result, it is specifically used to perform the following steps:

[0016] Determine the target resource as an unreferenced resource, and determine the resource referenced by the target resource as a resource to be detected;

[0017] Detect the citation status of the resources to be detected;

[0018] If the detection result indicates that the resource to be detected is not referenced by any resource other than unreferenced resources, the resource to be detected is determined as a deletable resource, and the resource to be detected is determined as a new unreferenced resource. The resource referenced by the resource to be detected is determined as a new resource to be detected, and the reference status of the new resource to be detected is detected until there are no referenced resources for subsequent resources to be detected.

[0019] In one implementation, the processing unit is used to detect resource references of each resource in the reference relationship chain, and when a deletable resource is determined in the reference relationship chain according to the detection result, is also used to perform the following steps:

[0020] If the detection result indicates that the resource to be detected is referenced by resources other than unreferenced resources, and there is no referenced resource other than the unreferenced resource that references the resource to be detected, then the resource to be detected is determined as a deletable resource, and the resource to be detected is determined as a new unreferenced resource, and the resource referenced by the resource to be detected is determined as a new resource to be detected, and the reference status of the new resource to be detected is detected until there is no referenced resource for subsequent resources to be detected.

[0021] In one implementation, the processing unit is used to perform the following steps when detecting the referenced status of the resource to be detected:

[0022] Identify the resource type of the resource to be detected;

[0023] Call the detection interface that matches the resource type of the resource to be detected to detect the reference status of the resource to be detected.

[0024] In one implementation, the processing unit is used to perform the following steps when detecting the referenced status of the resource to be detected:

[0025] Count the number of times the resource to be detected is cited in resources other than the reference relationship chain;

[0026] If the number of citations is equal to the number threshold, it is determined that the resource to be detected is not referenced by any resource other than the unreferenced resource;

[0027] If the number of citations is greater than the number threshold, it is determined that the resource to be detected is referenced by resources other than unreferenced resources.

[0028] In one implementation, the resources in the installation file include at least code type resources, configuration type resources, and media type resources; the processing unit is used to count the number of times the resource to be detected is referenced in the resources other than the reference relationship chain, and is specifically used to perform the following steps:

[0029] Count the number of times the resource to be detected is first cited in the code type resources other than the reference relationship chain;

[0030] Count the second number of times the resource to be detected is referenced in the configuration type resources other than the reference relationship chain;

[0031] Count the third citation times of the resource to be detected in the media type resources other than the citation relationship chain;

[0032] The sum of the first citation count, the second citation count, and the third citation count is determined as the citation count of the resource to be detected in the resources other than the citation relationship chain.

[0033] In one implementation, the acquisition unit is used to perform any of the following when receiving a resource deletion request for an installation file:

[0034] In response to a delete operation on a target resource, generating a resource deletion request;

[0035] In response to a resource reduction operation on an installation file, unavailable resources of the installation file are detected, where the unavailable resources are resources that are not referenced in the installation file; in response to a deletion operation on a target resource in the unavailable resources, a resource deletion request is generated.

[0036] In one implementation, the processing unit is used to perform the following steps when reducing the installation file according to the target resources and the deletable resources:

[0037] Get the reduction processing mode of the installation file, where the reduction processing mode is used to indicate the reduction processing method for the installation file;

[0038] The installation files are reduced in accordance with the reduction processing method indicated by the reduction processing mode and based on the target resources and the deletable resources.

[0039] In one implementation, when the reduction processing mode is the automatic reduction on mode, the processing unit is used to perform the following steps when reducing the installation file according to the reduction processing mode indicated by the reduction processing mode and based on the target resources and the deletable resources: automatically deleting the target resources and the deletable resources in the installation file;

[0040] When the reduction processing mode is the automatic reduction off mode, the processing unit is used to perform the following steps when reducing the installation files according to the reduction processing mode indicated by the reduction processing mode and according to the target resources and the deletable resources:

[0041] A deletable resource list is output, wherein the deletable resource list includes target resources and deletable resources; in response to a resource deletion operation performed on the deletable resource list, the resources on which the resource deletion operation is performed are deleted from the installation file.

[0042] In one implementation, the acquisition unit is used to acquire the reference relationship chain of the target resource by performing the following steps:

[0043] If the target resource has a referenced resource, the resource referenced by the target resource is added to the reference relationship chain as the first-level resource referenced by the target resource;

[0044] If the primary resource has referenced resources, the resources referenced by the primary resource are added to the reference relationship chain as secondary resources referenced by the target resource;

[0045] Continue to perform resource reference detection on the second-level resources, and continue to add subsequent-level resources to the reference relationship chain until there are no referenced resources in the subsequent-level resources.

[0046] In one implementation, the reference relationship chain includes one or more reference relationship sub-chains with the target resource as the reference starting point; the processing unit is used to detect the resource reference status of each resource on the reference relationship chain, and when it is determined that the deletable resource is in the reference relationship chain according to the detection result, it is specifically used to execute the following steps:

[0047] Selecting one or more target reference relationship sub-chains from among the reference relationship sub-chains included in the reference relationship chain;

[0048] The resource reference status of each resource on the target reference relationship subchain is detected, and the deletable resources are determined in the target reference relationship subchain according to the detection results.

[0049] Accordingly, an embodiment of the present application provides a computer device, the computer device comprising:

[0050] a processor suitable for implementing a computer program;

[0051] A computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the above-mentioned file processing method.

[0052] Accordingly, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is read and executed by a processor of a computer device, the computer device executes the above-mentioned file processing method.

[0053] Accordingly, an embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above-mentioned file processing method.

[0054] In an embodiment of the present application, after receiving a resource deletion request for deleting a target resource in an installation file, the resource references of each resource on the reference relationship chain of the target resource can be detected, and the deletable resources on the reference relationship chain of the target resource can be detected. Then, the installation file can be reduced based on the target resource and the deletable resources; the reference relationship chain of the target resource includes one or more levels of resources referenced by the target resource, and the one or more levels of resources referenced by the target resource refer to resources in the installation file that use the target resource as a reference starting point and have one or more levels of reference relationships with the target resource. It can be seen that the embodiment of the present application can not only reduce the installation file based on the target resource requested to be deleted, but also reduce the installation file based on the deletable resources on the reference relationship chain of the detected target resource, so that the installation file can be reduced more comprehensively and the resource reduction strength of the installation file can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0056] Figure 1 It is a schematic diagram of a reference relationship chain of resources in an installation file provided by an embodiment of the present application;

[0057] Figure 2 It is a schematic diagram of the architecture of a file processing system provided in an embodiment of the present application;

[0058] Figure 3 This is a schematic diagram of a file processing interaction process provided by an embodiment of the present application;

[0059] Figure 4 It is a flowchart of a file processing method provided by an embodiment of the present application;

[0060] Figure 5 It is a schematic diagram of a detection process of a reference relationship chain of a target resource provided in an embodiment of the present application;

[0061] Figure 6 This is a schematic diagram of a detection process of a reference situation of a picture type resource provided in an embodiment of the present application;

[0062] Figure 7 It is a flowchart of another file processing method provided in an embodiment of the present application;

[0063] Figure 8is a schematic diagram of a reference relationship sub-chain contained in a reference relationship chain provided in an embodiment of the present application;

[0064] Fig. 9 is a structural schematic diagram of a file processing device provided in an embodiment of the present application;

[0065] Fig.10 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0066] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0067] In order to more clearly understand the technical solutions provided by the embodiments of the present application, the key terms involved in the embodiments of the present application are first introduced here.

[0068] (1) The embodiments of the present application relate to a business product. A business product refers to an executable program that can be run in a terminal. The business product may include but is not limited to any of the following: an application program, and software, etc. The business product is obtained by installing an installation file in a terminal.

[0069] (2) The embodiments of the present application relate to installation files. An installation file may also be referred to as an installation package, which refers to a file that organizes resources such as code files, configuration files, and media files and is used to install a business product on a terminal. The file format of an installation file can be varied. Usually, the file format of an installation file is related to the operating system used by the terminal; for example, when the operating system of the terminal is Android (a mobile operating system), the file format of the installation file used to install the business product in the terminal is an ".apk file".

[0070] (3) The embodiments of the present application relate to resources in an installation file. The resources in the installation file can be understood as the constituent elements of the installation file, and the resource types in the installation file can include but are not limited to at least one of the following: code type resources (i.e., code files), configuration type resources (i.e., configuration files), and media type resources (i.e., media files), etc. Among them, code type resources can include, for example, classes (a data structure in a programming language), and class member variables (another data structure in a programming language), etc.; media type resources can include, for example, static resources such as string resources, image resources, and color resources.

[0071] There is a reference relationship between resources in the installation file. The reference relationship between resources in the installation file can be understood as the usage relationship between resources. For example, there are two resources, resource A and resource B, in the installation file. Resource B is used in resource A. It can be considered that there is a reference relationship between resource A and resource B. Resource A references resource B, and resource B is referenced by resource A. Based on the reference relationship between resource files in the installation file, each resource in the installation file can have a corresponding reference relationship chain. The reference relationship chain of resources can include primary or multi-level reference resources of resources; primary reference resources of resources refer to resources that have a primary reference relationship with resources, and resources that have a primary reference relationship with resources can be understood as direct reference resources of resources; multi-level reference resources of resources refer to resources that have a multi-level reference relationship with resources, and resources that have a multi-level reference relationship with resources can be understood as indirect reference resources of resources, which are resources further referenced by resources referenced by resources; for example, resources referenced by resources are primary reference resources of resources, secondary reference resources are resources referenced by primary reference resources of resources, and tertiary reference resources are resources referenced by secondary reference resources of resources. Figure 1 The figure shows a reference relationship chain of resources in an installation file, specifically a reference relationship chain of resource A in the installation file, resource A directly references resource B1 and resource B2, resource B1 and resource B2 are first-level reference resources of resource A, resource B1 references resource C1, resource B2 references resource C2 and resource C3, resource C1, resource C2 and resource C3 are second-level reference resources of resource A, resource C1 references resource D1, resource D1 is a third-level reference resource of resource A.

[0072] Based on this, an embodiment of the present application proposes a file processing method that can reduce the size of installation files. The file processing method provided by the embodiment of the present application can specifically provide a cascade reference detection function: after receiving a resource deletion request to delete a target resource in the installation file, in addition to reducing the size of the installation file based on the target resource, the deletable resources can also be detected in the reference relationship chain of the target resource, and the installation file can be reduced based on the deletable resources, so that the installation file can be reduced more comprehensively, thereby improving the resource reduction efforts of the installation file.

[0073] The file processing method provided in the embodiment of the present application can also specifically provide an auxiliary deletion decision function: the auxiliary deletion decision function can at least include a custom configuration installation file reduction processing mode, and a custom configuration of the associated output information of the deletable resources. For the auxiliary deletion decision function of the reduction processing mode of the custom configuration installation file, when the reduction processing mode of the custom configuration installation file is the automatic reduction on mode, the detected deletable resources can be automatically deleted, and when the reduction processing mode of the custom configuration installation file is the automatic reduction off mode, the detected deletable resources can be output and handed over to the developer of the installation file for deletion decision. For the auxiliary deletion decision function of the associated output information of the custom configuration deletable resources, the information type of the associated output information of the deletable resources can be customized, for example, the location information of the deletable resources in the installation file, the deletable reason information of the deletable resources, and the resource type information of the deletable resources can be output, etc. It can be seen that based on the auxiliary deletion decision function, the developer can make decisions on the reduction processing process of the installation file according to their own needs, so that the reduction processing process of the installation file has a higher degree of freedom, and the developer's installation file reduction experience is improved.

[0074] The following introduces a file processing system suitable for implementing the file processing method provided in the embodiment of the present application in conjunction with the accompanying drawings.

[0075] like Figure 2 As shown, the file processing system may include a terminal 201 and a server 202. A direct communication connection may be established between the terminal 201 and the server 202 by means of wired communication, or an indirect communication connection may be established by means of wireless communication. This is not limited in the embodiments of the present application. The terminal 201 may be a device used by the developer. The terminal may include any of the following: a smart phone, a tablet computer, a laptop computer, a desktop computer, an intelligent voice interaction device, a smart watch, a vehicle terminal, a smart home appliance, and an aircraft, etc., but is not limited thereto; the server 202 may be a separate physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. This is not limited in the embodiments of the present application. Among them:

[0076] (1) Terminal 201:

[0077] The terminal may run an installation file reduction tool, which may be used to reduce the installation files. The installation file reduction tool may include an integrated development environment (IDE) layer, an adaptation layer (Wrapper layer), a functional logic layer, and a business layer. The following describes the various components of the installation file reduction tool:

[0078] ① Integrated development environment layer: The integrated development environment layer can provide an integrated development environment, which can be used to provide development services for business products; further, the integrated development environment layer can provide one or more integrated development environments, for example, the integrated development environment layer can provide an integrated development environment in Android Studio (an integrated development tool), an integrated development environment in Visual Studio (another integrated development tool), and an integrated development environment in XCode (another integrated development tool), and so on; one or more integrated development environments can be used to provide development services for business products installed on different operating systems, for example, the integrated development environment in Android Studio can be used to provide development services for business products installed on the Android mobile operating system, and the integrated development environment in Visual Studio can be used to provide development services for business products installed on the Windows operating system, and so on.

[0079] The integrated development environment layer can also provide some third-party development tools on the integrated development environment, such as a syntax analyzer and a lexical analyzer, etc.; these third-party development tools can be used to provide interface functions for the interfaces in the adaptation layer.

[0080] ② Adaptation layer: The adaptation layer can be used to provide API (Application Programming Interface) to the functional logic layer. The interface provided by the adaptation layer may include at least a resource reference detection interface and a resource duplicate definition detection interface; wherein the resource reference detection interface can be used to detect whether a resource is referenced, and the resource duplicate definition detection interface can be used to detect whether a resource has duplicate definitions. The following table 1 exemplifies some interfaces provided by the adaptation layer to the functional logic layer:

[0081] Table 1

[0082]

[0083]

[0084] The purpose of setting up the adaptation layer is to eliminate the development differences brought about by different integrated development environments. The specific explanation is as follows: for the same interface (for example, an interface for detecting whether a string resource is referenced), different integrated development environments can use different methods to implement the interface function of the interface. When calling the interface in the adaptation layer, the functional logic layer only needs to pay attention to the interface function of the called interface, and is unaware of how different integrated development environments implement the interface function of the interface. It can be seen that the adaptation layer eliminates the development differences brought about by different integrated development environments, and the installation file reduction tool can be applicable to different integrated development environments. This makes the installation file reduction tool provided in the embodiment of the present application more universal and applicable to the reduction of installation files formed by different integrated development environments (i.e., installation files used to install business products in different operating systems).

[0085] ③ Functional logic layer: The functional logic layer can provide cascade reference detection function by calling the interface provided by the adaptation layer, that is, the functional logic layer can be used to detect deletable resources on the reference relationship chain of resources. The functional logic layer can also provide auxiliary deletion decision function, that is, the functional logic layer can be used to customize the reduction processing mode of the configuration installation file, and customize the associated output information of the configuration deletable resources.

[0086] ④ Business layer: The business layer can be used to provide visualization services to developers, for example, visualization output services and visualization operation services. Visualization operation services can be, for example, detection triggers by developers through the business layer to trigger the detection of deletable resources on the reference relationship chain of resources, or developers can customize the configuration of the business layer to install the file reduction processing mode, etc. Visualization output services can be, for example, outputting the list of deletable resources detected, or outputting the associated output information of deletable resources, etc.

[0087] (2) Server 202:

[0088] The server can be a device that provides data processing services for the installation file reduction tool. The server can be specifically used to provide a recording service for the installation file reduction process. The recording methods of the recording service may include: a file memo method and / or a callback notification method (for example, a webhook notification method); the file memo method refers to writing the recorded content into a file for backup and preservation, and the callback notification method is to call back the recorded content to the domain name customized by the developer in the server through a callback function, and the developer can obtain the recorded content by accessing the customized domain name. The recorded content of the recording service may include, for example: deletable resources, location information of deletable resources in the installation file, deletable reason information of deletable resources, resource type information of deletable resources, and reference relationship information of deletable resources, etc.

[0089] Based on the above-mentioned introduction of the related functions of the terminal 201 and the server 202, as shown in FIG. Figure 3 As shown, in the file processing system composed of the terminal 201 and the server 202, the exemplary file processing interaction process between the developer, the installation file reduction tool, and the server can be described as follows: the developer can request to delete resource A through the business layer of the installation file reduction tool, triggering the detection of the deletable resources on the reference relationship chain of resource A. If the developer customizes the reduction processing mode of the installation file to be the automatic reduction on mode, then after detecting the deletable resources on the reference relationship chain of resource A, the installation file reduction tool can automatically delete resource A and the deletable resources from the installation file, and record the deletion result in the server through the file memo method and / or the callback notification method, and the developer can obtain the deletion result by accessing the custom domain name in the server; if the developer customizes the reduction processing mode of the installation file to be the automatic reduction off mode, then after detecting the deletable resources on the reference relationship chain of resource A, the installation file reduction tool can output resource A and the deletable resources to the developer for the developer to make a deletion decision, and record the deletion result in the server through the file memo method and / or the callback notification method, and the developer can obtain the deletion result by accessing the custom domain name in the server. After the reduction process of the installation file is completed, the installation file reduction tool can feedback the installation file reduction completion notification to the developer.

[0090] It can be seen that in the file processing system composed of the terminal 201 and the server 202, the installation file reduction tool eliminates the development differences caused by different integrated development environments, so that the installation file reduction tool provided by the embodiment of the present application can be applied to different integrated development environments, and can reduce the installation files formed by different integrated development environments, thereby improving the versatility of the installation file reduction function. The installation file reduction tool can detect deletable resources in the reference relationship chain of resources, and reduce the installation files according to the deletable resources, so that the installation files can be reduced more comprehensively, and the resource reduction strength of the installation files can be improved. The installation file reduction tool provides developers with visual services, so that developers can configure the reduction processing mode of the installation files and make decisions on the deletion of deletable resources, which can better meet the developer's reduction needs for installation files. The installation file reduction tool can make the deletion of deletable resources traceable by recording deletable resources, deletable reason information of deletable resources, and reference relationship information of deletable resources, so that developers can better confirm whether the reduction processing of the installation files meets expectations.

[0091] It can be understood that the file processing system described in the embodiment of the present application is for more clearly illustrating the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.

[0092] The following introduces a file processing system suitable for implementing the file processing method provided in the embodiment of the present application in conjunction with the accompanying drawings.

[0093] The present application embodiment provides a file processing method, which mainly introduces the cascade reference detection function provided by the file processing method, that is, the function of detecting deletable resources on the reference relationship chain of resources. The file processing method can be executed by a computer device, which can be, for example, the terminal 201 in the above-mentioned file processing system, such as Figure 4 As shown, the file processing method may include but is not limited to the following steps S401 to S404:

[0094] S401, receiving a resource deletion request for an installation file; the installation file is used to install a business product, the installation file includes multiple resources, and the resource deletion request is used to request deletion of a target resource in the installation file.

[0095] The installation file can be used to install business products, which can reduce the file size of the installation file corresponding to the business product to a certain extent, and can play a positive role in the installation of the business product. Therefore, it can trigger the detection of useless resources in the installation file for deletion, thereby reducing the file size of the installation file to a certain extent. The detection of useless resources in the installation file can be triggered by a resource deletion request of the installation file. The installation file can include multiple resources. The resource deletion request can be used to request the deletion of the target resource in the installation file, and can also be used to request the detection of deletable resources on the reference relationship chain of the target resource. The triggering method of the resource deletion request can include any of the following:

[0096] ① In response to the deletion operation on the target resource, a resource deletion request is generated. The triggering method of the resource deletion request can be applicable to the scenario where the developer realizes that the target resource is a useless resource. The developer can actively trigger the deletion of the target resource, thereby generating a resource deletion request. In addition, after the developer actively triggers the deletion of the target resource, the deletable resources in the reference relationship chain of the target resource can be detected. The deletable resources in the reference relationship chain of the target resource are also useless resources in the installation file and can be deleted. In this way, the installation file can be reduced more comprehensively, which can improve the reduction of the installation file.

[0097] ② In response to the resource reduction operation on the installation file, unavailable resources of the installation file are detected, and unavailable resources are resources that are not referenced in the installation file; in response to the deletion operation on the target resource in the unavailable resources, a resource deletion request can be generated. The triggering method of the resource deletion request can be applicable to the scenario where the developer has the need to reduce the installation file. The developer can actively trigger the reduction process of the installation file. The installation file reduction tool can detect the unavailable resources in the installation file, that is, the useless resources in the installation file that are not referenced by other resources. The developer can select one or more target resources from the unavailable resources for deletion, thereby generating a resource deletion request. That is to say, after the developer actively triggers the reduction process of the installation file, the developer can select the target resources to be deleted from the unavailable resources of the detected installation file, and after selecting the target resources to be deleted from the unavailable resources, the deletable resources in the reference relationship chain of the target resource can be triggered to detect.

[0098] S402, obtaining a reference relationship chain of the target resource, the reference relationship chain including one or more levels of resources referenced by the target resource; the one or more levels of resources referenced by the target resource refer to resources in the installation file that use the target resource as a reference starting point and have one or more levels of reference relationships with the target resource.

[0099] A resource deletion request can also be used to request detection of deletable resources in the reference relationship chain of the target resource. In order to respond to the resource deletion request, the reference relationship chain of the target resource can be obtained; the reference relationship chain of the target resource may include primary or multi-level resources referenced by the target resource; the primary resource referenced by the target resource refers to a resource in the installation file that uses the target resource as the reference starting point and has a primary reference relationship with the target resource; the multi-level resource referenced by the target resource refers to a resource in the installation file that uses the target resource as the reference starting point and has a multi-level reference relationship with the target resource.

[0100] The method for obtaining the reference relationship chain of the target resource may include: if the target resource has a referenced resource, the resource referenced by the target resource may be added to the reference relationship chain of the target resource as a first-level resource referenced by the target resource; if the first-level resource of the target resource has a referenced resource, the resource referenced by the first-level resource may be added to the reference relationship chain of the target resource as a second-level resource referenced by the target resource; then, the second-level resource may continue to be checked for resource references, that is, whether the second-level referenced resource has a referenced resource, and subsequent-level resources may continue to be added to the reference relationship chain of the target resource until there are no referenced resources in the subsequent-level resources.

[0101] by Figure 1Taking the method of obtaining the reference relationship chain of the target resource (for example, the target resource is resource A) shown as an example, resource A has referenced resources, and the resources referenced by resource A are resource B1 and resource B2. Resource B1 and resource B2 can be added to the reference relationship chain of resource A as first-level resources referenced by resource A (that is, first-level referenced resources of resource A); among the first-level resources, resource B1 has referenced resources, and the resource referenced by resource B1 is resource C1; resource B2 has referenced resources, and the resources referenced by resource B2 are resources C2 and resource C3. Resource C1, resource C2 and resource C3 can be added to the reference relationship chain of resource A as second-level resources referenced by resource A (that is, second-level referenced resources of resource A); among the second-level resources, resource C1 has referenced resources, and resources C2 and resource C3 do not have referenced resources. The resource referenced by resource C1 is resource D1. Resource D1 can be added to the reference relationship chain of resource A as a third-level resource referenced by resource A (that is, third-level referenced resource of resource A). In the third-level resources, resource D1 does not have any referenced resources, and can eventually obtain Figure 1 The reference relationship chain of the target resource (for example, the target resource is resource A) is shown.

[0102] S403: Check the resource reference status of each resource in the reference relationship chain, and determine the deletable resources in the reference relationship chain according to the check result.

[0103] After obtaining the reference relationship chain of the target resource, the resource reference status of each resource on the reference relationship chain of the target resource can be detected, and the deletable resources can be determined in the reference relationship chain according to the detection results; deletable resources refer to resources in the reference relationship chain that are not referenced by other resources except the reference relationship chain, or resources in the reference relationship chain that are referenced by other resources except the reference relationship chain but are not referenced by other resources. Specifically:

[0104] Determine the target resource as an unreferenced resource, and determine the resource referenced by the target resource as a resource to be detected; detect the referenced status of the resource to be detected, specifically, detect whether the resource to be detected is referenced by resources other than the unreferenced resource; if the detection result indicates that the resource to be detected is not referenced by resources other than the unreferenced resource, then the resource to be detected can be determined as a deletable resource, and the resource to be detected can be determined as a new unreferenced resource, and the resource referenced by the resource to be detected can be determined as a new resource to be detected, and the referenced status of the new resource to be detected can be detected until there are no referenced resources for subsequent resources to be detected. If the detection result indicates that the resource to be detected is referenced by resources other than the unreferenced resource, and there are no referenced resources other than the unreferenced resource that reference the resource to be detected, then the resource to be detected can be determined as a deletable resource, and the resource to be detected can be determined as a new unreferenced resource, and the resource referenced by the resource to be detected can be determined as a new resource to be detected, and the referenced status of the new resource to be detected can be detected until there are no referenced resources for subsequent resources to be detected. That is to say, for any resource to be detected on the reference relationship chain of the target resource, if the resource to be detected is not referenced by any resources other than the resources on the reference relationship chain, or if the resource to be detected is referenced by any resources other than the resources on the reference relationship chain but no other resources are referenced, then the resource to be detected can be determined as a deletable resource on the reference resource chain of the target resource.

[0105] Furthermore, the above-mentioned process of detecting the resource reference situation of each resource on the reference relationship chain of the target resource and determining the deletable resources in the reference relationship chain according to the detection results can be performed using two data structures, which are an unreferenced resource pool (unrefer_list) and a resource pool to be detected (need_detect_list). Among them, the unreferenced resource pool can be used to store unreferenced resources, and unreferenced resources refer to resources to be deleted. The resources to be deleted in the unreferenced resource pool can be directly deleted (for example, corresponding to the automatic reduction on mode of the installation file), or can be provided to the developer for selective deletion (for example, corresponding to the automatic reduction off mode of the installation file). The resource pool to be detected can be used to store resources to be detected, and the resources to be detected refer to the resources referenced by the unreferenced resources. If the unreferenced resources are deleted, it is necessary to further detect whether the resources referenced by the unreferenced resources can be deleted. Therefore, the resources referenced by the unreferenced resources can be added to the resource pool to be detected as resources to be detected.

[0106] After clarifying the purpose of the two data structures of unreferenced resource pool and to-be-detected resource pool, the following is combined Figure 5, introduces the process of detecting the resource reference status of each resource on the reference relationship chain of the target resource, and determining the deletable resources in the reference relationship chain based on the detection results, with the participation of two data structures, the unreferenced resource pool and the to-be-detected resource pool:

[0107] ① The resource reference status of each resource on the reference relationship chain of the target resource can be detected, and a process of determining the deletable resources in the reference relationship chain can be initiated based on the detection results; if the unreferenced resource pool is not empty (for example, the target resource has been added to the unreferenced resource pool as an unreferenced resource), an unreferenced resource can be selected from the unreferenced resource pool; if the unreferenced resource pool is empty, it can be determined whether the unreferenced resource needs to be added manually. If necessary, the target resource can be added to the unreferenced resource pool as an unreferenced resource. If not, the resource reference status of each resource on the reference relationship chain of the target resource can be detected, and based on the detection results, the process of determining the deletable resources in the reference relationship chain fails to start.

[0108] ② The resources referenced by the unreferenced resources can be added to the resource pool to be detected as resources to be detected; the resource type of the resources referenced by the unreferenced resources (i.e., the resources to be detected) can also be identified; when the reduction processing mode of the installation file is the automatic reduction off mode, the unreferenced resources can also be marked as resources that need to be provided to the developer for deletion decisions.

[0109] ③ The resource pool to be detected can be traversed, and the resources to be detected in the resource pool to be detected can be detected one by one to detect the reference status of the resources to be detected; if the detection result indicates that the resource to be detected is not referenced by any resource other than the unreferenced resource, the resource to be detected can be added to the unreferenced resource pool as a new unreferenced resource, and the traversal of the resource pool to be detected can be continued; if the detection result indicates that the resource to be detected is referenced by any resource other than the unreferenced resource, and there is no reference to any resource other than the unreferenced resource that references the resource to be detected, the resource to be detected can be added to the unreferenced resource pool as a new unreferenced resource, and the traversal of the resource pool to be detected can be continued; if the detection result indicates that the resource to be detected is referenced by any resource other than the unreferenced resource, and there is no reference to any resource other than the unreferenced resource that references the resource to be detected, the traversal of the resource pool to be detected can be continued.

[0110] ④ If the traversal of the resource pool to be detected has not been completed, the traversal of the resource pool to be detected can continue to be performed to detect the referenced status of the undetected resources in the resource pool to be detected. If the traversal of the resource pool to be detected is completed, another unreferenced resource can be selected from the unreferenced resource pool, and ①-④ are repeated until there are no unreferenced resources in the unreferenced resource pool, and there is no need to manually add unreferenced resources.

[0111] It can be seen that for the target resource, after the target resource is added to the unreferenced resource pool as an unreferenced resource, the resource referenced by the unreferenced resource is added to the resource pool to be detected as a resource to be detected. If the resource to be detected is not referenced by any resource other than the unreferenced resource, or if the resource to be detected is referenced by any resource other than the unreferenced resource, and there is no reference to any resource other than the unreferenced resource that references the resource to be detected, then the resource to be detected can be added to the unreferenced resource pool as a new unreferenced resource. In this way, the resource in the reference relationship chain of the target resource that is added to the unreferenced resource pool is the deletable resource in the reference relationship chain of the target resource, and all deletable resources on the reference relationship chain of the target resource can be recursively detected. It can be found that the target resource may be a resource that is not referenced, and the deletable resource in the reference relationship chain of the target resource is a resource that is referenced but unreachable by reference. Specifically, the resource that references the deletable resource is a reference resource (the reference resource may include a reference resource that references the deletable resource on the reference relationship chain, or a reference resource that references the deletable resource outside the reference relationship chain). The deletable resource is referenced but unreachable by reference, which can be understood as at least one of the following: the reference resource is not referenced (specifically, it means that the reference resource that references the deletable resource outside the reference relationship chain is not referenced), the reference resource is referenced but unreachable by reference (specifically, it means the reference resource that references the deletable resource on the reference relationship chain. The reference resource may be referenced on the reference relationship chain, but the resource that references the reference resource may not be referenced). Thus, the target resource and the deletable resources on the reference relationship chain of the target resource can form an unreachable reference resource chain, or it can be called an unreachable path. The resources on the unreachable reference resource chain are not referenced, or are referenced but unreachable. The purpose of detecting the resource reference status of each resource on the reference relationship chain of the target resource can be understood as finding the unreachable reference resource chain in the reference relationship chain of the target resource. Except for the target resource, the resources in the unreachable reference resource chain are the deletable resources in the reference relationship chain of the target resource.

[0112] It is worth noting that in the process of detecting the resource references of each resource in the reference relationship chain of the target resource and determining the deletable resources in the reference relationship chain according to the detection results, the method of detecting the references of the resources to be detected may include any of the following:

[0113] The first detection method is to call the detection interface that matches the resource type for detection. Specifically, the resource type of the resource to be detected can be identified; then, the detection interface that matches the resource type of the resource to be detected (specifically, the resource reference detection interface) can be called to detect the referenced situation of the resource to be detected. For example, referring to Table 1 above, when the resource type of the resource to be detected is a picture type, the detection interface that matches the picture type (checkDrawableRefered) can be called to detect the referenced situation of the resource to be detected of the picture type; when the resource type of the resource to be detected is a string type, the detection interface that matches the string type can be called (checkStringRefered) to detect the referenced situation of the resource to be detected of the string type.

[0114] The second detection method is to detect the number of citations. Specifically, the number of citations of the resource to be detected in the resources other than the reference relationship chain can be counted; if the number of citations is equal to the number threshold (the number threshold here is set by the R&D personnel who installed the file reduction tool based on experience, and is used to judge whether the resource to be detected is referenced by resources other than unreferenced resources, for example, the number threshold can be 0), then it can be determined that the resource to be detected is not referenced by resources other than unreferenced resources; if the number of citations is greater than the number threshold (for example, the number threshold can be 0), it can be determined that the resource to be detected is referenced by resources other than unreferenced resources, and the resources that reference the resource to be detected can be further detected for the reference situation.

[0115] For the second detection method, optionally, the resources in the installation file may include at least code type resources, configuration type resources, and media type resources; the method of counting the number of times the resource to be detected is cited in resources other than the reference relationship chain may include: counting the first number of times the resource to be detected is cited in code type resources other than the reference relationship chain; counting the second number of times the resource to be detected is cited in configuration type resources other than the reference relationship chain; and counting the third number of times the resource to be detected is cited in media type resources other than the reference relationship chain; and determining the sum of the first number of times cited, the second number of times cited, and the third number of times cited as the number of times the resource to be detected is cited in resources other than the reference relationship chain.

[0116] Take the resource to be detected as an image resource as an example. Figure 6As shown, the picture resource can be searched in the code type resource except the reference relationship chain, and the first reference number of the picture resource in the code type resource except the reference relationship chain is counted; the picture resource can be searched in the configuration type resource except the reference relationship chain, and the second reference number of the picture resource in the configuration type resource except the reference relationship chain is counted; the picture resource can be searched in the picture type resource except the reference relationship chain, and the third reference number of the picture resource in the picture type resource except the reference relationship chain is counted; when the installation file is used to install a business product in the Android mobile operating system, the configuration type resource can be AndroidManifest (a configuration file), and the picture type resource can be stored in the drawable (a picture resource file) directory. Then, the first reference number + the second reference number + the third reference number = the reference number of the resource to be detected; if the reference number of the resource to be detected = 0, it can be determined that the resource to be detected is not referenced by resources other than unreferenced resources; if the reference number of the resource to be detected> 0, it can be determined that the resource to be detected is referenced by resources other than unreferenced resources.

[0117] S404: Reduce the installation files according to the target resources and the deletable resources.

[0118] After determining the deletable resources in the reference relationship chain of the target resource, the installation file can be reduced according to the target resource and the deletable resources. The reduction processing method is related to the reduction processing mode, and the reduction processing mode can be custom configured by the developer.

[0119] In an embodiment of the present application, after receiving a resource deletion request for deleting a target resource in an installation file, the resource references of each resource on the reference relationship chain of the target resource can be detected, and the deletable resources on the reference relationship chain of the target resource can be detected. Then, the installation file can be reduced based on the target resource and the deletable resources; the reference relationship chain of the target resource includes one or more levels of resources referenced by the target resource, and the one or more levels of resources referenced by the target resource refer to resources in the installation file that use the target resource as a reference starting point and have one or more levels of reference relationships with the target resource. It can be seen that the embodiment of the present application can not only reduce the installation file based on the target resource requested to be deleted, but also reduce the installation file based on the deletable resources on the reference relationship chain of the detected target resource, so that the installation file can be reduced more comprehensively and the resource reduction strength of the installation file can be improved.

[0120] The present application embodiment provides a file processing method, which mainly introduces the auxiliary deletion decision function provided by the file processing method, namely, the function of customizing the configuration reduction processing mode and customizing the decision of resources to be deleted. The file processing method can be executed by a computer device, which can be, for example, the terminal 201 in the above-mentioned file processing system, such as Figure 7 As shown, the file processing method may include but is not limited to the following steps S701 to S705:

[0121] S701, receiving a resource deletion request for an installation file; the installation file is used to install a business product, the installation file includes multiple resources, and the resource deletion request is used to request deletion of a target resource in the installation file.

[0122] In the embodiment of the present application, the execution process of step S701 is the same as that of the above Figure 4 The execution process of step S401 in the embodiment shown is the same. For the specific execution process, please refer to the above Figure 4 The description of step S401 in the illustrated embodiment will not be repeated here.

[0123] S702, obtaining a reference relationship chain of the target resource, the reference relationship chain including one or more levels of resources referenced by the target resource; the one or more levels of resources referenced by the target resource refer to resources in the installation file that use the target resource as a reference starting point and have one or more levels of reference relationships with the target resource.

[0124] In the embodiment of the present application, the execution process of step S702 is the same as that of the above Figure 4 The execution process of step S402 in the embodiment shown is the same. For the specific execution process, please refer to the above Figure 4 The description of step S402 in the illustrated embodiment will not be repeated here.

[0125] S703: Check the resource reference status of each resource in the reference relationship chain, and determine the deletable resources in the reference relationship chain according to the check result.

[0126] The reference relationship chain of the target resource may include one or more reference relationship sub-chains with the target resource as the reference starting point. Figure 8As shown, the reference relationship chain of the target resource (for example, the target resource is resource A) may include three reference relationship subchains, namely the first reference relationship subchain "resource A→resource B1→resource C1→resource D1", the second reference relationship subchain "resource A→resource B2→resource C2", and the third reference relationship subchain "resource A→resource B2→resource C3". In this case, one or more target reference relationship subchains may be selected from the reference relationship subchains included in the reference relationship chain, and then the resource reference conditions of each resource on the target reference relationship subchain may be detected, and the deletable resources may be determined in the target reference relationship subchain according to the detection results.

[0127] The method of selecting one or more target reference relationship sub-chains from among the reference relationship sub-chains included in the reference relationship chain may include any of the following:

[0128] ① Developers can customize the selection of one or more target reference relationship sub-chains from the reference relationship sub-chains included in the reference relationship chain; this method can provide developers with a higher degree of freedom in reducing installation files during the installation file reduction process. Developers can freely decide to detect the deletable resources in the target reference relationship sub-chain in the reference relationship chain of the target resource, which can better meet the developer's installation file reduction needs.

[0129] ② Select one or more target reference relationship subchains in the reference relationship chain according to the selection rule. The selection rule may include at least one of the following: space occupancy selection rule and chain length selection rule. Among them, the space occupancy selection rule refers to selecting the reference relationship subchain with the largest space occupancy in the reference relationship chain as the target reference relationship subchain. For example, Figure 8 Among the first reference relationship subchain, the second reference relationship subchain and the third reference relationship subchain shown, the third reference relationship subchain occupies the largest space, so the third reference relationship subchain can be selected as the target reference relationship subchain; it is worth noting that the space occupancy selection rule takes into account the total space occupied by each resource in the reference relationship subchain. Selecting the reference relationship subchain with the largest space occupancy and detecting the deletable resources therein can increase the reduction of the installation file. After deleting the deletable resources detected in the reference relationship subchain with the largest space occupancy, the file size of the installation file is reduced to a greater extent. The chain length selection rule refers to selecting the reference relationship subchain with the longest chain length (containing the largest number of resources) in the reference relationship chain as the target reference relationship subchain. For example, in Figure 8Among the first reference relationship subchain, the second reference relationship subchain and the third reference relationship subchain shown, the first reference relationship subchain has the longest chain length, and the first reference relationship subchain can be selected as the target reference relationship subchain; it is worth noting that the chain length selection rule takes into account the chain length of the reference relationship subchain, and the chain length is actually the number of resources contained. Selecting the reference relationship subchain with the longest chain length is to select the reference relationship subchain with the largest number of resources. Generally, the more resources contained in the reference relationship subchain, the larger the space occupied by the reference relationship subchain. Selecting the reference relationship subchain with the largest number of resources and detecting the deletable resources therein can increase the reduction of the installation file. After deleting the deletable resources detected in the reference relationship subchain that occupies the largest space, the file size of the installation file is reduced to a greater extent.

[0130] When the selection rules include both space occupancy selection rules and chain length selection rules, the space occupancy selection rules and the chain length selection rules can be used in conjunction with each other. For example, after first using the space occupancy selection rule to select a reference relationship subchain, if there are at least two reference relationship subchains in the reference relationship chain of the target resource that occupy the same space, then in this case, for at least two reference relationship subchains that occupy the same space, the chain length selection rule can be used again to select the reference relationship subchain with the longest chain length as the target reference relationship subchain; for another example, after first using the chain length selection rule to select a reference relationship subchain, if there are at least two reference relationship subchains in the reference relationship chain of the target resource that have the same chain length, then in this case, for at least two reference relationship subchains with the same chain length, the space occupancy selection rule can be used again to select the reference relationship subchain with the largest space occupancy as the target reference relationship subchain.

[0131] ③ Based on a random algorithm, one or more target reference relationship sub-chains can be randomly selected in the reference relationship chain.

[0132] It should be noted that after selecting one or more target reference relationship subchains from among the reference relationship subchains included in the reference relationship chain, the resource reference conditions of each resource on the target reference relationship subchain are detected, and the process of determining the deletable resources in the target reference relationship subchain according to the detection results is the same as the above process. Figure 4 In step S403 of the embodiment shown, the resource reference status of each resource in the reference relationship chain of the target resource is detected, and the process of determining the deletable resource in the reference relationship chain of the target resource according to the detection result is the same. The specific execution process can be referred to above. Figure 4 The relevant description of step S403 in the illustrated embodiment will not be repeated here.

[0133] S704, obtaining a reduction processing mode of the installation file, where the reduction processing mode is used to indicate a reduction processing method for the installation file.

[0134] The reduction process of the installation file is related to the reduction mode of the installation file, and the reduction mode can be used to indicate the reduction method for the installation file. The reduction mode can be the default setting of the installation file reduction tool; or, the reduction mode can be customized by the developer in the installation file reduction tool, so that the developer can configure the reduction mode according to his or her own installation file reduction habits. In addition to better meeting the developer's installation file reduction habits, it can also improve the freedom of the installation file reduction process for the developer, thereby improving the developer's experience of reducing installation files in the installation file reduction tool. The reduction mode can include an automatic reduction on mode and an automatic reduction off mode; the reduction method indicated by the automatic reduction on mode is to automatically delete the target resources and the detected deletable resources in the installation file; the reduction method indicated by the automatic reduction off mode is to output the target resources and the detected deletable resources to the developer, and the developer decides on the deletable resources that need to be deleted.

[0135] S705: Perform reduction processing on the installation file according to the reduction processing manner indicated by the reduction processing mode and based on the target resources and the deletable resources.

[0136] When the reduction processing mode is the automatic reduction on mode, the installation file is reduced in accordance with the reduction processing mode indicated by the reduction processing mode and according to the target resources and the deletable resources, which may include: automatically deleting the target resources and the deletable resources in the installation file. When the reduction processing mode is the automatic reduction off mode, the installation file is reduced in accordance with the reduction processing mode indicated by the reduction processing mode and according to the target resources and the deletable resources, which may include: outputting a deletable resource list, which may include the target resources and the deletable resources; and in response to a resource deletion operation performed on the deletable resource list, deleting the resources on which the resource deletion operation is performed in the installation file.

[0137] Furthermore, when outputting a list of deletable resources, the associated output information of each resource in the list of deletable resources can also be output; the associated output information of the resource can include but is not limited to at least one of the following: the location information of the resource in the installation file, the deletable reason information of the resource (for example, the resource does not exist and is referenced, or the resource exists and is referenced but is unreachable), and the resource type information of the resource. By outputting the location information of the resource in the installation file, the developer can quickly locate the resource and view the context information of the resource in the installation file, which can assist the developer in making more accurate resource deletion decisions; by outputting the deletable reason information of the resource, the developer can intuitively understand the deletable reason of the resource, which can assist the developer in making more accurate resource deletion decisions; by outputting the resource type information of the resource, the developer can intuitively understand the resource type, which can assist the developer in making more accurate resource deletion decisions.

[0138] It should be added that when outputting the associated output information of each resource in the deletable resource list, the type of the output associated output information may be set by default by the installation file reduction tool. Alternatively, in order to further increase the freedom of the installation file reduction process for developers and better meet the installation file reduction habits of developers, developers may customize the type of the output associated information. For example, the output associated information customized by the developer may include: the location information of the resource in the installation file and the deletable reason information of the resource.

[0139] Based on the contents of step S704 to step S705 in the embodiment of the present application, the auxiliary deletion decision function provided by the file processing method can be summarized as shown in the following Table 2:

[0140] Table 2

[0141]

[0142] It can be seen that based on the auxiliary deletion decision function provided by the file processing method, developers can customize the configuration reduction processing mode according to their own installation file reduction needs and installation file reduction habits, customize the selection of resources to be deleted from the resources to be deleted, and customize the type of associated output information of the resources to be deleted. This can better meet the developer's installation file reduction needs and better meet the developer's installation file reduction habits, so that the installation file reduction process has a higher degree of freedom and improves the developer's installation file reduction experience.

[0143] In an embodiment of the present application, when the reference relationship chain of the target resource includes a reference relationship subchain, one or more target reference relationship subchains can be selected from the reference relationship subchains included in the reference relationship chain of the target resource, and the deletable resources in the selected target reference relationship subchains can be detected; for the case where the reference relationship subchain is selected according to the selection rule, the reference relationship subchain that has a greater impact on the file size of the installation file can be selected for detection, so that the reduction efficiency of the installation file can be improved under the premise of ensuring that the installation file meets a certain reduction force; for the case where the reference relationship subchain is selected by the developer, the developer can retain the reference relationship subchain that may affect the installation process of the installation file, so as to avoid problems in the installation process of the installation file after the installation file is reduced. In addition, the auxiliary deletion decision function provided based on the file processing method can better meet the developer's installation file reduction needs and the developer's installation file reduction habits, so that the installation file reduction process has a higher degree of freedom, and improves the developer's installation file reduction experience.

[0144] The method of the embodiment of the present application is described in detail above. In order to facilitate better implementation of the above scheme of the embodiment of the present application, the device of the embodiment of the present application is provided below accordingly.

[0145] See also Fig. 9 , Fig. 9 is a structural schematic diagram of a file processing device provided in an embodiment of the present application. The file processing device can be arranged in a computer device provided in an embodiment of the present application. The computer device can be Figure 2 Terminal in the file processing system shown. Fig. 9 The file processing device shown may be a computer program (including program code) running in a computer device, and the file processing device may be used to execute Figure 4 or Figure 7 Some or all of the steps in the method embodiment shown. Fig. 9 The file processing device may include the following units:

[0146] The acquisition unit 901 is used to receive a resource deletion request for an installation file; the installation file is used to install a business product, the installation file includes multiple resources, and the resource deletion request is used to request to delete a target resource in the installation file;

[0147] The acquisition unit 901 is further used to acquire a reference relationship chain of the target resource, the reference relationship chain including one or more levels of resources referenced by the target resource; the one or more levels of resources referenced by the target resource refer to resources in the installation file that use the target resource as a reference starting point and have one or more levels of reference relationships with the target resource;

[0148] Processing unit 902 is used to detect resource reference conditions of each resource in the reference relationship chain, and determine deletable resources in the reference relationship chain according to the detection result; deletable resources refer to resources in the reference relationship chain that are not referenced by other resources except the reference relationship chain, or resources in the reference relationship chain that are referenced by other resources except the reference relationship chain but are not referenced by other resources;

[0149] The processing unit 902 is further configured to reduce the installation files according to the target resources and the deletable resources.

[0150] In one implementation, the processing unit 902 is used to detect resource references of each resource in the reference relationship chain, and when a deletable resource is determined in the reference relationship chain according to the detection result, it is specifically used to perform the following steps:

[0151] Determine the target resource as an unreferenced resource, and determine the resource referenced by the target resource as a resource to be detected;

[0152] Detect the citation status of the resources to be detected;

[0153] If the detection result indicates that the resource to be detected is not referenced by any resource other than unreferenced resources, the resource to be detected is determined as a deletable resource, and the resource to be detected is determined as a new unreferenced resource. The resource referenced by the resource to be detected is determined as a new resource to be detected, and the reference status of the new resource to be detected is detected until there are no referenced resources for subsequent resources to be detected.

[0154] In one implementation, the processing unit 902 is used to detect resource references of each resource in the reference relationship chain, and when a deletable resource is determined in the reference relationship chain according to the detection result, it is also used to perform the following steps:

[0155] If the detection result indicates that the resource to be detected is referenced by resources other than unreferenced resources, and there is no referenced resource other than the unreferenced resource that references the resource to be detected, then the resource to be detected is determined as a deletable resource, and the resource to be detected is determined as a new unreferenced resource, and the resource referenced by the resource to be detected is determined as a new resource to be detected, and the reference status of the new resource to be detected is detected until there is no referenced resource for subsequent resources to be detected.

[0156] In one implementation, the processing unit 902 is used to perform the following steps when detecting the referenced status of the resource to be detected:

[0157] Identify the resource type of the resource to be detected;

[0158] Call the detection interface that matches the resource type of the resource to be detected to detect the reference status of the resource to be detected.

[0159] In one implementation, the processing unit 902 is used to perform the following steps when detecting the referenced status of the resource to be detected:

[0160] Count the number of times the resource to be detected is cited in resources other than the reference relationship chain;

[0161] If the number of citations is equal to the number threshold, it is determined that the resource to be detected is not referenced by any resource other than the unreferenced resource;

[0162] If the number of citations is greater than the number threshold, it is determined that the resource to be detected is referenced by resources other than unreferenced resources.

[0163] In one implementation, the resources in the installation file include at least code type resources, configuration type resources, and media type resources; the processing unit 902 is used to count the number of times the resource to be detected is referenced in the resources other than the reference relationship chain, and is specifically used to perform the following steps:

[0164] Count the number of times the resource to be detected is first cited in the code type resources other than the reference relationship chain;

[0165] Count the second number of times the resource to be detected is referenced in the configuration type resources other than the reference relationship chain;

[0166] Count the third citation times of the resource to be detected in the media type resources other than the citation relationship chain;

[0167] The sum of the first citation count, the second citation count, and the third citation count is determined as the citation count of the resource to be detected in the resources other than the citation relationship chain.

[0168] In one implementation, the acquisition unit 901 is used to perform any of the following when receiving a resource deletion request for an installation file:

[0169] In response to a delete operation on a target resource, generating a resource deletion request;

[0170] In response to a resource reduction operation on an installation file, unavailable resources of the installation file are detected, where the unavailable resources are resources that are not referenced in the installation file; in response to a deletion operation on a target resource in the unavailable resources, a resource deletion request is generated.

[0171] In one implementation, the processing unit 902 is used to perform the following steps when reducing the installation file according to the target resources and the deletable resources:

[0172] Get the reduction processing mode of the installation file, where the reduction processing mode is used to indicate the reduction processing method for the installation file;

[0173] The installation files are reduced in accordance with the reduction processing method indicated by the reduction processing mode and based on the target resources and the deletable resources.

[0174] In one implementation, when the reduction processing mode is the automatic reduction on mode, the processing unit 902 is used to perform the following steps when reducing the installation file according to the target resources and the deletable resources in the reduction processing mode indicated by the reduction processing mode: automatically deleting the target resources and the deletable resources in the installation file;

[0175] When the reduction processing mode is the automatic reduction off mode, the processing unit 902 is used to perform the following steps when reducing the installation files according to the reduction processing mode indicated by the reduction processing mode and according to the target resources and the deletable resources:

[0176] A deletable resource list is output, wherein the deletable resource list includes target resources and deletable resources; in response to a resource deletion operation performed on the deletable resource list, the resources on which the resource deletion operation is performed are deleted from the installation file.

[0177] In one implementation, the acquisition unit 901 is used to acquire the reference relationship chain of the target resource by performing the following steps:

[0178] If the target resource has a referenced resource, the resource referenced by the target resource is added to the reference relationship chain as the first-level resource referenced by the target resource;

[0179] If the primary resource has referenced resources, the resources referenced by the primary resource are added to the reference relationship chain as secondary resources referenced by the target resource;

[0180] Continue to perform resource reference detection on the second-level resources, and continue to add subsequent-level resources to the reference relationship chain until there are no referenced resources in the subsequent-level resources.

[0181] In one implementation, the reference relationship chain includes one or more reference relationship sub-chains with the target resource as the reference starting point; the processing unit 902 is used to detect the resource reference status of each resource on the reference relationship chain, and when it is determined that the deletable resource is in the reference relationship chain according to the detection result, it is specifically used to perform the following steps:

[0182] Selecting one or more target reference relationship sub-chains from among the reference relationship sub-chains included in the reference relationship chain;

[0183] The resource reference status of each resource on the target reference relationship subchain is detected, and the deletable resources are determined in the target reference relationship subchain according to the detection results.

[0184] According to another embodiment of the present application, Fig. 9 The various units in the file processing device shown can be separately or completely combined into one or several other units to form, or one (some) of the units can be further divided into multiple functionally smaller units to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the file processing device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.

[0185] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 4 or Figure 7 A computer program (including program code) for each step involved in part or all of the method shown in the figure is used to construct a computer program (including program code) for each step involved in part or all of the method shown in the figure. Fig. 9 The file processing device shown in the embodiment of the present application is used to implement the file processing method of the embodiment of the present application. The computer program can be recorded on a computer-readable storage medium, for example, and loaded into the above-mentioned computing device through the computer-readable storage medium and run therein.

[0186] In an embodiment of the present application, after receiving a resource deletion request for deleting a target resource in an installation file, the resource references of each resource on the reference relationship chain of the target resource can be detected, and the deletable resources on the reference relationship chain of the target resource can be detected. Then, the installation file can be reduced based on the target resource and the deletable resources; the reference relationship chain of the target resource includes one or more levels of resources referenced by the target resource, and the one or more levels of resources referenced by the target resource refer to resources in the installation file that use the target resource as a reference starting point and have one or more levels of reference relationships with the target resource. It can be seen that the embodiment of the present application can not only reduce the installation file based on the target resource requested to be deleted, but also reduce the installation file based on the deletable resources on the reference relationship chain of the detected target resource, so that the installation file can be reduced more comprehensively and the resource reduction strength of the installation file can be improved.

[0187] Based on the above method and device embodiments, the present application embodiment provides a computer device, which can be Figure 2 Terminal in a file handling system as shown. See Fig.10 , Fig.10It is a structural diagram of a computer device provided in an embodiment of the present application. Fig.10 The computer device shown includes at least a processor 1001, an input interface 1002, an output interface 1003, and a computer-readable storage medium 1004. The processor 1001, the input interface 1002, the output interface 1003, and the computer-readable storage medium 1004 may be connected via a bus or other means.

[0188] The computer-readable storage medium 1004 may be stored in a memory of a computer device. The computer-readable storage medium 1004 is used to store a computer program. The computer program includes computer instructions. The processor 1001 is used to execute the program instructions stored in the computer-readable storage medium 1004. The processor 1001 (or CPU (Central Processing Unit)) is the computing core and control core of the computer device, which is suitable for implementing one or more computer instructions, and is specifically suitable for loading and executing one or more computer instructions to implement a corresponding method flow or a corresponding function.

[0189] The embodiment of the present application also provides a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space that stores the operating system of the computer device. In addition, one or more computer instructions suitable for being loaded and executed by the processor are also stored in the storage space. These computer instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory, or a non-volatile memory (Non-VolatileMemory), such as at least one disk storage; optionally, it can also be at least one computer-readable storage medium located away from the aforementioned processor.

[0190] In some embodiments, the processor 1001 may load and execute one or more computer instructions stored in the computer-readable storage medium 1004 to implement the above-mentioned Figure 4 or Figure 7 In a specific implementation, the computer instructions in the computer-readable storage medium 1004 are loaded by the processor 1001 and execute the following steps:

[0191] Receive a resource deletion request for an installation file; the installation file is used to install a business product, the installation file includes multiple resources, and the resource deletion request is used to request deletion of a target resource in the installation file;

[0192] Obtain the reference relationship chain of the target resource, which includes the primary or multi-level resources referenced by the target resource; the primary or multi-level resources referenced by the target resource refer to the resources in the installation file that use the target resource as the reference starting point and have a primary or multi-level reference relationship with the target resource;

[0193] Detect the resource reference status of each resource on the reference relationship chain, and determine the deletable resources in the reference relationship chain according to the detection results; the deletable resources refer to the resources in the reference relationship chain that are not referenced by other resources except the reference relationship chain, or the resources in the reference relationship chain that are referenced by other resources except the reference relationship chain but are not referenced by other resources;

[0194] The installation files are reduced based on the target resources and the deletable resources.

[0195] In one implementation, the computer instructions in the computer-readable storage medium 1004 are loaded and executed by the processor 1001 to detect the resource reference status of each resource in the reference relationship chain, and when a deletable resource is determined in the reference relationship chain according to the detection result, the computer instructions are specifically used to execute the following steps:

[0196] Determine the target resource as an unreferenced resource, and determine the resource referenced by the target resource as a resource to be detected;

[0197] Detect the citation status of the resources to be detected;

[0198] If the detection result indicates that the resource to be detected is not referenced by any resource other than unreferenced resources, the resource to be detected is determined as a deletable resource, and the resource to be detected is determined as a new unreferenced resource. The resource referenced by the resource to be detected is determined as a new resource to be detected, and the reference status of the new resource to be detected is detected until there are no referenced resources for subsequent resources to be detected.

[0199] In one implementation, the computer instructions in the computer-readable storage medium 1004 are loaded and executed by the processor 1001 to detect the resource reference status of each resource in the reference relationship chain, and when a deletable resource is determined in the reference relationship chain according to the detection result, the computer instructions are further used to execute the following steps:

[0200] If the detection result indicates that the resource to be detected is referenced by resources other than unreferenced resources, and there is no referenced resource other than the unreferenced resource that references the resource to be detected, then the resource to be detected is determined as a deletable resource, and the resource to be detected is determined as a new unreferenced resource, and the resource referenced by the resource to be detected is determined as a new resource to be detected, and the reference status of the new resource to be detected is detected until there is no referenced resource for subsequent resources to be detected.

[0201] In one implementation, when the computer instructions in the computer-readable storage medium 1004 are loaded and executed by the processor 1001 to detect the referenced status of the resource to be detected, the computer instructions are specifically used to perform the following steps:

[0202] Identify the resource type of the resource to be detected;

[0203] Call the detection interface that matches the resource type of the resource to be detected to detect the reference status of the resource to be detected.

[0204] In one implementation, when the computer instructions in the computer-readable storage medium 1004 are loaded and executed by the processor 1001 to detect the referenced status of the resource to be detected, the computer instructions are specifically used to perform the following steps:

[0205] Count the number of times the resource to be detected is cited in resources other than the reference relationship chain;

[0206] If the number of citations is equal to the number threshold, it is determined that the resource to be detected is not referenced by any resource other than the unreferenced resource;

[0207] If the number of citations is greater than the number threshold, it is determined that the resource to be detected is referenced by resources other than unreferenced resources.

[0208] In one implementation, the resources in the installation file include at least code type resources, configuration type resources, and media type resources; when the computer instructions in the computer readable storage medium 1004 are loaded and executed by the processor 1001 to count the number of times the resource to be detected is referenced in the resources other than the reference relationship chain, the computer instructions are specifically used to perform the following steps:

[0209] Count the number of times the resource to be detected is first cited in the code type resources other than the reference relationship chain;

[0210] Count the second number of times the resource to be detected is referenced in the configuration type resources other than the reference relationship chain;

[0211] Count the third citation times of the resource to be detected in the media type resources other than the citation relationship chain;

[0212] The sum of the first citation count, the second citation count, and the third citation count is determined as the citation count of the resource to be detected in the resources other than the citation relationship chain.

[0213] In one implementation, the computer instructions in the computer-readable storage medium 1004 are loaded and executed by the processor 1001 when receiving a resource deletion request for an installation file, and are specifically used to perform any of the following:

[0214] In response to a delete operation on a target resource, generating a resource deletion request;

[0215] In response to a resource reduction operation on an installation file, unavailable resources of the installation file are detected, where the unavailable resources are resources that are not referenced in the installation file; in response to a deletion operation on a target resource in the unavailable resources, a resource deletion request is generated.

[0216] In one implementation, when the computer instructions in the computer-readable storage medium 1004 are loaded and executed by the processor 1001 to reduce the installation files according to the target resources and the deletable resources, the computer instructions are specifically used to perform the following steps:

[0217] Get the reduction processing mode of the installation file, where the reduction processing mode is used to indicate the reduction processing method for the installation file;

[0218] The installation files are reduced in accordance with the reduction processing method indicated by the reduction processing mode and based on the target resources and the deletable resources.

[0219] In one implementation, when the reduction processing mode is the automatic reduction on mode, the computer instructions in the computer readable storage medium 1004 are loaded and executed by the processor 1001 according to the reduction processing mode indicated by the reduction processing mode, and when the installation file is reduced according to the target resources and the deletable resources, the computer instructions are specifically used to perform the following steps: automatically deleting the target resources and the deletable resources in the installation file;

[0220] When the reduction processing mode is the automatic reduction off mode, the computer instructions in the computer readable storage medium 1004 are loaded and executed by the processor 1001 according to the reduction processing mode indicated by the reduction processing mode, and when the installation file is reduced according to the target resources and the deletable resources, it is specifically used to perform the following steps:

[0221] A deletable resource list is output, wherein the deletable resource list includes target resources and deletable resources; in response to a resource deletion operation performed on the deletable resource list, the resources on which the resource deletion operation is performed are deleted from the installation file.

[0222] In one implementation, when the computer instructions in the computer-readable storage medium 1004 are loaded and executed by the processor 1001 to obtain the reference relationship chain of the target resource, they are specifically used to perform the following steps:

[0223] If the target resource has a referenced resource, the resource referenced by the target resource is added to the reference relationship chain as the first-level resource referenced by the target resource;

[0224] If the primary resource has referenced resources, the resources referenced by the primary resource are added to the reference relationship chain as secondary resources referenced by the target resource;

[0225] Continue to perform resource reference detection on the second-level resources, and continue to add subsequent-level resources to the reference relationship chain until there are no referenced resources in the subsequent-level resources.

[0226] In one implementation, the reference relationship chain includes one or more reference relationship sub-chains with the target resource as the reference starting point; the computer instructions in the computer readable storage medium 1004 are loaded and executed by the processor 1001 to detect the resource reference status of each resource on the reference relationship chain, and when it is determined that the deletable resource is in the reference relationship chain according to the detection result, it is specifically used to execute the following steps:

[0227] Selecting one or more target reference relationship sub-chains from among the reference relationship sub-chains included in the reference relationship chain;

[0228] The resource reference status of each resource on the target reference relationship subchain is detected, and the deletable resources are determined in the target reference relationship subchain according to the detection results.

[0229] In an embodiment of the present application, after receiving a resource deletion request for deleting a target resource in an installation file, the resource references of each resource on the reference relationship chain of the target resource can be detected, and the deletable resources on the reference relationship chain of the target resource can be detected. Then, the installation file can be reduced based on the target resource and the deletable resources; the reference relationship chain of the target resource includes one or more levels of resources referenced by the target resource, and the one or more levels of resources referenced by the target resource refer to resources in the installation file that use the target resource as a reference starting point and have one or more levels of reference relationships with the target resource. It can be seen that the embodiment of the present application can not only reduce the installation file based on the target resource requested to be deleted, but also reduce the installation file based on the deletable resources on the reference relationship chain of the detected target resource, so that the installation file can be reduced more comprehensively and the resource reduction strength of the installation file can be improved.

[0230] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the file processing method provided in the above various optional modes.

[0231] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A file processing method, characterized in that: include: Receive a resource deletion request for an installation file; the installation file is used to install a business product, the installation file includes multiple resources, and the resource deletion request is used to request deletion of a target resource in the installation file; Acquire a reference relationship chain of the target resource, the reference relationship chain including one or more levels of resources referenced by the target resource; the one or more levels of resources referenced by the target resource refer to resources in the installation file that use the target resource as a reference starting point and have one or more levels of reference relationships with the target resource; Detecting resource references of each resource on the reference relationship chain, and determining deletable resources in the reference relationship chain according to the detection result; The deletable resource refers to a resource in the reference relationship chain that is not referenced by any other resource except the reference relationship chain, or a resource in the reference relationship chain that is referenced by any other resource except the reference relationship chain but is not referenced by any other resource; The installation file is reduced according to the target resource and the deletable resource.

2. The method according to claim 1, characterized in that The detecting of resource reference conditions of each resource on the reference relationship chain and determining deletable resources in the reference relationship chain according to the detection result includes: Determine the target resource as an unreferenced resource, and determine the resource referenced by the target resource as a resource to be detected; Detecting the reference status of the resource to be detected; If the detection result indicates that the resource to be detected is not referenced by any resource other than the unreferenced resource, the resource to be detected is determined as the deletable resource, and the resource to be detected is determined as a new unreferenced resource, and the resource referenced by the resource to be detected is determined as a new resource to be detected, and the reference status of the new resource to be detected is detected until there is no referenced resource for the subsequent resource to be detected.

3. The method according to claim 2, characterized in that The detecting of resource reference conditions of each resource on the reference relationship chain and determining deletable resources in the reference relationship chain according to the detection result also includes: If the detection result indicates that the resource to be detected is referenced by resources other than the unreferenced resources, and there is no referenced resource other than the unreferenced resources that references the resource to be detected, then the resource to be detected is determined as the deletable resource, and the resource to be detected is determined as a new unreferenced resource, and the resource referenced by the resource to be detected is determined as a new resource to be detected, and the reference status of the new resource to be detected is detected until there is no referenced resource for subsequent resources to be detected.

4. The method according to claim 2 or 3, characterized in that The detecting of the referenced status of the resource to be detected includes: Identify the resource type of the resource to be detected; A detection interface matching the resource type of the resource to be detected is called to detect the referenced status of the resource to be detected.

5. The method according to claim 2 or 3, characterized in that: The detecting of the referenced status of the resource to be detected includes: Counting the number of times the resource to be detected is cited in resources other than the reference relationship chain; If the number of times of being cited is equal to the number threshold, it is determined that the resource to be detected is not cited by any resource other than the unreferenced resource; If the number of times the resource is cited is greater than the number threshold, it is determined that the resource to be detected is cited by a resource other than the unreferenced resource.

6. The method according to claim 5, characterized in that The resources in the installation file include at least code type resources, configuration type resources, and media type resources; and counting the number of times the resource to be detected is referenced in resources other than the reference relationship chain includes: Counting the first number of citations of the resource to be detected in code type resources other than the reference relationship chain; Counting the second number of times the resource to be detected is referenced in the configuration type resources other than the reference relationship chain; Counting the third number of times the resource to be detected is referenced in media type resources other than the reference relationship chain; The sum of the first reference count, the second reference count, and the third reference count is determined as the reference count of the resource to be detected in resources other than the reference relationship chain.

7. The method according to claim 1, characterized in that The receiving of a resource deletion request for the installation file includes any of the following: In response to a deletion operation on the target resource, generating the resource deletion request; In response to a resource reduction operation on the installation file, unavailable resources of the installation file are detected, where the unavailable resources are resources that are not referenced in the installation file; in response to a deletion operation on a target resource in the unavailable resources, the resource deletion request is generated.

8. The method according to claim 1, characterized in that The reducing the installation file according to the target resource and the deletable resource comprises: Acquire a reduction processing mode of the installation file, where the reduction processing mode is used to indicate a reduction processing method for the installation file; The installation file is reduced in accordance with the reduction processing manner indicated by the reduction processing mode and based on the target resource and the deletable resource.

9. The method according to claim 8, characterized in that When the reduction processing mode is the automatic reduction on mode, the reduction processing is performed on the installation file according to the target resource and the deletable resource in accordance with the reduction processing mode indicated by the reduction processing mode, including: automatically deleting the target resource and the deletable resource in the installation file; When the reduction processing mode is the automatic reduction off mode, the reduction processing of the installation file according to the reduction processing mode indicated by the reduction processing mode and according to the target resource and the deletable resource includes: Outputting a deletable resource list, wherein the deletable resource list includes the target resource and the deletable resource; in response to a resource deletion operation performed on the deletable resource list, deleting the resource on which the resource deletion operation is performed in the installation file.

10. The method according to claim 1, characterized in that The obtaining of the reference relationship chain of the target resource includes: If the target resource has a referenced resource, the resource referenced by the target resource is taken as a primary resource referenced by the target resource and added to the reference relationship chain; If the primary resource has a referenced resource, the resource referenced by the primary resource is used as a secondary resource referenced by the target resource and added to the reference relationship chain; Continue to perform resource reference detection on the secondary resource, and continue to add subsequent level resources to the reference relationship chain until there is no referenced resource in the subsequent level resources.

11. The method according to claim 1, characterized in that The reference relationship chain includes one or more reference relationship sub-chains with the target resource as the reference starting point; detecting the resource reference status of each resource on the reference relationship chain, and determining the deletable resource in the reference relationship chain according to the detection result, including: Selecting one or more target reference relationship sub-chains from among the reference relationship sub-chains included in the reference relationship chain; The resource reference status of each resource on the target reference relationship sub-chain is detected, and the deletable resources are determined in the target reference relationship sub-chain according to the detection result.

12. A file processing device, characterized in that: include: An acquisition unit, configured to receive a resource deletion request of an installation file; the installation file is used to install a business product, the installation file includes a plurality of resources, and the resource deletion request is used to request deletion of a target resource in the installation file; The acquisition unit is further used to acquire a reference relationship chain of the target resource, wherein the reference relationship chain includes one or more levels of resources referenced by the target resource; the one or more levels of resources referenced by the target resource refer to resources in the installation file that use the target resource as a reference starting point and have a one or more level of reference relationship with the target resource; A processing unit, configured to detect resource reference conditions of each resource on the reference relationship chain, and determine deletable resources in the reference relationship chain according to the detection result; The deletable resource refers to a resource in the reference relationship chain that is not referenced by any other resource except the reference relationship chain, or a resource in the reference relationship chain that is referenced by any other resource except the reference relationship chain but is not referenced by any other resource; The processing unit is further used to reduce the installation file according to the target resource and the deletable resource.

13. A computer device, characterized in that: The computer device comprises: a processor suitable for implementing a computer program; A computer-readable storage medium storing a computer program, wherein the computer program is suitable for being loaded by the processor and executing the file processing method according to any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the file processing method according to any one of claims 1 to 11.

15. A computer program product, characterized in that The computer program product comprises computer instructions, and when the computer instructions are executed by a processor, the file processing method according to any one of claims 1 to 11 is implemented.