CN114297157B - File processing method, device, equipment and medium - Google Patents

File processing method, device, equipment and medium Download PDF

Info

Publication number
CN114297157B
CN114297157B CN202111652504.8A CN202111652504A CN114297157B CN 114297157 B CN114297157 B CN 114297157B CN 202111652504 A CN202111652504 A CN 202111652504A CN 114297157 B CN114297157 B CN 114297157B
Authority
CN
China
Prior art keywords
file
application
package name
application package
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111652504.8A
Other languages
Chinese (zh)
Other versions
CN114297157A (en
Inventor
李志刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202111652504.8A priority Critical patent/CN114297157B/en
Publication of CN114297157A publication Critical patent/CN114297157A/en
Application granted granted Critical
Publication of CN114297157B publication Critical patent/CN114297157B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the disclosure relates to a file processing method, a device, equipment and a medium, wherein the method comprises the following steps: responding to a call request of a preset file creation function, and acquiring an initiating application identifier and a file creation path corresponding to the call request; determining a target application package name corresponding to the initiating application identifier; constructing an association relationship between a target application package name and a file creation path; and storing the association relation in a preset storage position. Therefore, when the file is created, the corresponding application identifier and the creation path are recorded, so that record omission of file creation is avoided, the recording efficiency is improved, in addition, the recorded actual creation path of the file is convenient for accurately determining the file creation application.

Description

File processing method, device, equipment and medium
Technical Field
The disclosure belongs to the technical field of data processing, and in particular relates to a file processing method, device, equipment and medium.
Background
With the increase of applications installed on electronic devices such as smartphones, the number of files created by the applications is also large, so in order to facilitate management of files, it is determined that the creation of an application for each file is required in many scenarios.
In the related art, a file save path of each application is predefined and stored, and then, a creation application of a corresponding file is determined according to the file save path. For example, the file save path for storing the video or the picture of the application a in advance is: and/Storage/Pictures/A, when the Storage path of a certain file is identified as/Storage/Pictures/A, determining that the creation application of the corresponding file is an A application.
However, in the above method for determining the file creation application according to the pre-stored file storage path, a large number of file storage paths used by the application need to be recorded in advance, and the determination of the creation application for the relevant file may not be performed for the newly installed application because the corresponding file storage path is not recorded in time.
Disclosure of Invention
In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a method, an apparatus, a device, and a medium for processing a file, where when a file is created, corresponding application identifiers and creation paths are recorded, so that record omission of file creation is avoided, recording efficiency is improved, and in addition, the recorded actual creation paths of the file facilitate accurate determination of file creation applications.
The embodiment of the disclosure provides a file processing method, which comprises the following steps: responding to a call request of a preset file creation function, and acquiring an initiating application identifier and a file creation path corresponding to the call request; determining a target application package name corresponding to the initiating application identifier; constructing an association relationship between the name of the target application package and the file creation path; and storing the association relation in a preset storage position.
The embodiment of the disclosure also provides a file processing device, which comprises: the acquisition module is used for responding to a call request of a preset file creation function and acquiring an initiation application identifier and a file creation path corresponding to the call request; the determining module is used for determining the name of the target application package of the initiating application identifier; the construction module is used for constructing the association relationship between the name of the target application package and the file creation path and the target file; and the storage module is used for storing the association relation in a preset storage position.
The embodiment of the disclosure also provides an electronic device, which comprises: a processor; a memory for storing the processor-executable instructions; the processor is configured to read the executable instructions from the memory and execute the instructions to implement a file processing method as provided in an embodiment of the disclosure.
The present disclosure also provides a computer-readable storage medium storing a computer program for executing the file processing method as provided by the embodiments of the present disclosure.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages:
according to the file processing scheme provided by the embodiment of the disclosure, an initiating application identifier and a file creation path corresponding to a call request are obtained in response to the call request of a preset file creation function, further, a target application package name corresponding to the initiating application identifier is determined, an association relationship between the target application package name and the file creation path is constructed, and the association relationship is stored in a preset storage position. Therefore, when the file is created, the corresponding application identifier and the creation path are recorded, so that record omission of file creation is avoided, the recording efficiency is improved, in addition, the recorded actual creation path of the file is convenient for accurately determining the file creation application.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
Fig. 1 is a schematic flow chart of a file processing method according to an embodiment of the disclosure;
FIG. 2 is a flowchart illustrating another method for processing a file according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram of a target application packet name determination scenario provided in an embodiment of the present disclosure;
fig. 4 is a schematic view of a file processing scenario provided in an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of another document processing scenario provided in an embodiment of the present disclosure;
fig. 6 is a schematic diagram of association relationship containing content according to an embodiment of the disclosure;
FIG. 7 is a schematic diagram of content included in a database according to an embodiment of the present disclosure;
FIG. 8 is a schematic diagram of another document processing scenario provided by an embodiment of the present disclosure;
FIG. 9 is a schematic diagram of a document processing apparatus according to an embodiment of the disclosure;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
In order to solve the problem that when a file creation path of an application is stored in advance, the creation application cannot be determined when the newly installed application does not store the file creation path in time when the creation application locates the creation application according to the file creation path created in advance, and the creation application cannot be determined when the file creation path is modified when the creation application actually creates a file, the embodiment of the disclosure provides a file processing method, in which real-time record of creation information about the file creation path and the like is performed in real time following the creation of the file, so that the accuracy and efficiency of the determination of the creation application are ensured, and the method is described below in connection with specific embodiments.
Fig. 1 is a flow chart of a method for processing a file according to an embodiment of the disclosure, where the method may be performed by a file processing apparatus, and the apparatus may be implemented by software and/or hardware, and may be generally integrated in an electronic device. As shown in fig. 1, the method includes:
Step 101, acquiring an initiating application identifier and a file creation path in response to a call request of a preset file creation function.
The file creation function may be understood as a method function that needs to be called when creating a file, for example, functions such as open, mkdir, create, and the like.
In this embodiment, since the related creation application calls the file creation function when creating the target file, it is first required to monitor whether the preset file creation function is called.
In different application scenarios, the manner of monitoring whether the preset file creation function is called is different, and examples are as follows:
in one embodiment of the present disclosure, a hook function associated with a file creation function is pre-constructed, for example, a call address of the file creation function may be modified to a call address of the hook function, and when the hook function is called, a call request to the file creation function is considered to be acquired, and a corresponding file creation function is called.
In another embodiment of the present disclosure, since the created target file is necessarily stored in the preset storage space of the terminal device, a memory change of the preset storage space may be detected, when a memory increase of the current preset storage space is detected, it is determined whether the memory increase value is greater than a preset threshold, and if so, it is considered that a call request of the target file to the preset file creation function is acquired.
Secondly, responding to a call request of a preset file creation function, and acquiring an initiating application identifier and a file creation path corresponding to the call request, wherein the initiating application identifier can be one or more of user identification (User Identification, UID) of an application, an application name, application icon information and the like.
It is emphasized that the file creation path in the present embodiment is an actual file creation path at the time of creation of the target file, and therefore positioning the creation application thereof based on the file creation path ensures the accuracy of positioning.
In one embodiment of the present disclosure, in order to further determine that the file creation path is an actual file creation path when the target file is created, whether the target file is created successfully is monitored, for example, whether occupation of the file creation function by the target file is released is monitored, if so, the target file is considered to be created successfully, for example, whether the target file meets a preset integrity condition is checked, if so, whether the picture is saved completely is checked, and the like.
In this embodiment, if the creation of the target file is successful, the processing function is a function that can obtain the initiation application identifier and the file creation path of the corresponding target file through presetting a processing function in the file creation function, so as to obtain the initiation application identifier and the file creation path of the target file.
Step 102, determining a target application package name corresponding to the initiating application identifier.
It should be appreciated that the originating application identification may not uniquely correspond to the corresponding application, e.g., when the originating application identification is a UID, if there are other applications sharing the UID, it is apparent that multiple created applications may be located based on the originating application identification.
Therefore, in this embodiment, the target application package name of the creating application is determined based on the originating application identifier, and the target application package name may be understood as identification information uniquely corresponding to the application, for example, since the application package name refers to a software package name (code naming space) and is a package specified when the application is developed, the target application package name may be the application package name, or the like, and if the originating application identifier and the application are in one-to-one correspondence, the originating application identifier may be determined as the corresponding target application package name.
In one embodiment of the present disclosure, as shown in fig. 2, determining a target application package name according to an originating application identifier includes:
step 201, inquiring a preset application package name list according to an initiating application identifier to obtain at least one reference application package name.
In this embodiment, it is determined whether the reference application packet name corresponding to the originating application identifier is plural, and if plural, it is obvious that the unique creating application cannot be located based on the corresponding originating application identifier.
In different application scenarios, the ways of judging whether the reference application packet names corresponding to the originating application identifier are multiple are different are exemplified as follows:
in one embodiment of the present disclosure, if the originating application identifier is a UID, it is determined whether the UID belongs to a corresponding shared UID, and in some possible embodiments, naming rules of package names of files sharing the UID are different, for example, for a shared UID user corresponding to UID1000, the corresponding application package name is shared.
In some possible embodiments, in order to ensure that the application package name of the originating application identifier can be queried by the data/system/packages, the mapping relationship between the UID and the package name can be maintained in real time, so as to query the application package name of each originating application identifier according to the mapping relationship.
In this embodiment, in the Java layer of the system, the API function getpackagsforuic directly obtains the package name from the UID, so that the corresponding application package name can be directly obtained through the getpackagsforuic, if the corresponding terminal device is an Android system, and the application package name is obtained in the Native C language layer, the mapping relationship between the package names of all applications and the corresponding UIDs can be queried, and the mapping relationship can be updated when the application is installed and uninstalled, so that the method adopted in this example is to start a change of thread monitoring/data/system/packages, and if the change is, the mapping relationship between the content UID and the package name of the file is read, and query interfaces are provided to other modules, so that services for obtaining the application package name through the UID are provided.
In some possible implementations, the mapping relationship stored in the packages, list, may be as follows, where 10222, 10217, 10121 correspond to the UID in the mapping relationship described below.
com.smartisanos.writer 10122 1/data/user/0/com.smartisanos.writer platform:targetSdkVersion=27 3003 1 1;
com.achievo.vipshop10217 0/data/user/0/com.achievo.vipshop default:targetSdkVersion=28 3002,3003 0 70704;
com.smartisanos.share.browser101210/data/user/0/com.smartisanos.sh are.browser default:targetSdkVersion=17 3003 0 1;
Step 202, if at least one reference application package name is one, determining that the corresponding reference application package name is the target application package name.
In this embodiment, if at least one reference application package name is one, since the application package name corresponds to the application uniquely, the reference application package name may be directly determined as the target application package name.
Further, in an embodiment of the present disclosure, the method further includes:
step 203, if at least one reference application packet name is multiple, acquiring preset auxiliary identification information of the originating application identification.
In this embodiment, if the reference application package name is plural, the target application package name that can uniquely locate the creation application is further determined in the plural target applications.
As mentioned above, the application package name is identification information uniquely corresponding to the application, so in this embodiment, if the reference application package name is plural, the preset application package name list/data/system/packages is queried to obtain plural reference application package names corresponding to the plural reference application package names.
And 204, determining the target application package name in a plurality of reference application package names according to the preset auxiliary identification information.
In this embodiment, a target application package name is selected from a plurality of reference application package names according to a preset selection policy, and the target application package name is determined to be a target application package name of a target file.
In this embodiment, if at least one reference application packet name is multiple, preset auxiliary identification information of an originating application identification is obtained, the preset auxiliary identification information is unique identification information corresponding to an application, and a target application packet name is determined from the multiple reference application packet names according to the preset auxiliary identification information.
It should be noted that, in different application scenarios, the preset auxiliary identification information is different, and examples are as follows:
as a possible implementation manner, when the preset auxiliary identifier information is an application icon, since the application corresponding to the application icon is unique, or when the preset auxiliary identifier information is an application name, the corresponding application is also unique, so in this embodiment, the application icon or the application name that initiates the application identifier may be acquired, and the target application package name may be acquired based on the application icon or the application name.
In this embodiment, the call time of an application calling a preset file creation function and the request time of each application in the system for occupying network resources to send a request may be obtained, if the call time matches with the request time, an application icon or an application name of the corresponding application may be obtained, and a target application package name may be obtained according to the application icon or the application name.
As another possible implementation, setting the extension attribute needs to be done in a separate thread, instead of setting the extension attribute directly in the file creation interface function, because setting the extension attribute is also an interface function that invokes the file system, thus creating a nested call, so to avoid the nested call, a separate first thread is used in this implementation to accomplish the function of setting the extension attribute.
In this embodiment, since the first thread is pulled up according to the call request of the related application, the corresponding thread identification information corresponds to the application indication displacement, and thus, in this embodiment, the target application packet name can be uniquely determined by the thread identification information. In this embodiment, the target application packet name may be obtained by checking/proc/thread number/cmdline node, and an obtaining function of PID parameter (thread identification information) may be directly added to the file creation function, if the originating application identifier corresponds to multiple reference application packet names, the target application packet name may be further obtained by reading/proc/thread number/cmdline node through PID, so that the application packet name may be uniquely determined.
In still another embodiment of the present disclosure, as shown in fig. 3, a plurality of application icon thumbnails for targets may be further obtained, query information including the application icon thumbnails of the plurality of target applications is displayed in a pop-up window form, and an application identifier corresponding to the application icon thumbnail triggered by the user is selected as a target application package name according to a triggering operation of the user.
And step 103, constructing the association relation between the name of the target application package and the file creation path.
In this embodiment, an association relationship between a target application package name and a file creation path is constructed, so that it can be further verified based on the file creation path in the association relationship, whether the current file storage path of the queried target file is consistent with the file creation path in the association relationship, if so, the association relationship is considered to be reliable, and therefore, the creation application of the corresponding file is determined based on the target application package name in the association relationship. If the current file storage path of the target file is inconsistent with the file creation path in the association relationship, the corresponding target file is considered to move, so that alarm information and the like are sent, virus investigation processing is conveniently carried out on the target file, whether the target file is maliciously moved or not is timely perceived, or the association relationship of the target file is updated, and the like, so that the accuracy of the association relationship is not affected even if the storage position of the target file is updated.
It should be noted that, in different application scenarios, in order to facilitate positioning and creating an application, the above-mentioned association relationship may be stored in a preset storage location, or in order to facilitate querying, may also be directly stored in the target file in a manner of extending the attribute.
The method comprises the steps that a target application package name of a creator of a target file is stored in an extension attribute of the target file, the target application package name is unique in an Android system and can identify an application, if a terminal device is a Linux file system, the corresponding extension attribute provides a mechanism for permanently associating a Key value pair with the target file, the extension attribute can add an additional Key-value Key value pair to the file, and the Key and the value are character strings and have a limit of a certain length. The extended attribute needs support of an underlying file system, and when the extended attribute is used, a file system description article needs to be checked to see whether the file system supports the extended attribute, and relevant support of an extended attribute naming space and the like. File systems including btrfs, ext2, ext3, ext4, f2fs, JFS, reiserfs, lustrefs, and XFS all support EA. While various types of file systems are optional for support of extended properties.
For example, if the system of the terminal device is Android 11, since the underlying file system of Android 11 adopts F2FS, this file system may already support extended attributes, for example, extended attributes such as user. However, in the Android system, all applications cannot directly access the F2FS file system, but two Overlay-property sdcardfs and FUSE file systems are added on the F2FS file system, and FUSE is on the sdcardfs. Within the platform existing code, neither the sdcarbfs nor the fuse file system supports extended attributes, nor the existing extended attribute permission checking mechanism allows sdcarbfs and fuse access, extended attributes of user. Thus, the following functions need to be implemented in this example: the trans-package is added to save the application package name, the access rule of the trans-attribute is added, the trans-attribute is allowed to access across the file system, the Fuse, the sdcarbfs and the f2fs can access the trans-attribute, in addition, in the embodiment, the operation functions of the sdcarbfs and the extended attribute of the Fuse file system are also needed to be realized, the actual saving of the extended attribute is the function of transparent forwarding in the f2fs file system, and the related interfaces of the extended attribute realized by the sdcarbfs and the Fuse file system are all functions of transparent forwarding, wherein, as shown in fig. 4, the sdcarbfs layer is accessed by the Fuse layer, and the f2fs layer is accessed by the sdcarbfs layer.
In the independent first thread, as shown in fig. 5, a file processing request is generated in response to a call request of a target file to a preset file creation function, and the file creation application request may be arranged in a message queue.
Thus, in this embodiment, a key value pair is generated according to the destination application package name and the file creation path, where, as shown in fig. 6, the key may correspond to the destination application package name, the value corresponds to the file creation path, and the key value pair is stored in the extended attribute of the destination file, so that each destination file carries a corresponding creation application label, and efficiency of positioning the creation application is improved.
Step 104, storing the association relation in a preset storage position.
In this embodiment, the association relationship is stored in a preset storage location, for example, a key value pair is stored in an extended attribute of the target file, or the association relationship may be stored separately in a related database.
In one embodiment of the present disclosure, in order to further facilitate obtaining a corresponding target file, the surface traverses all files in a disk, and may further store an association relationship between a target application package name and a file creation path in a preset database, where the preset database may be stored in a cloud server, and based on the database, the target file may be obtained according to the correspondence relationship, so as to implement quick search and obtaining of the target file. The storage of the database and the setting of the extended attribute are required to be completed in a second independent thread, and the processing flow is the same, but the final result is that the name of the target application package and the file creation path are written into the database.
In some possible embodiments, as shown in fig. 7, each row in the preset database stores a corresponding destination application package name package and a file creation path, and the path of the destination file can be quickly determined based on the corresponding destination application package name package, so that the destination file can be quickly found according to the path of the destination file, and operations such as downloading the destination file can be realized.
Thus, as shown in fig. 8, in the embodiment of the present disclosure, the solution includes a file creation interface module, an extended attribute setting module, and a database saving module, where the file creation interface module is a file creation function for creating various files and folders provided by a file system, and includes open, mkdir, create, and the like, and a processing function needs to be added into the interfaces of these file creation functions. The processing function sends an initiating application identifier (UID in the embodiment) and a file creating PATH (PATH in the embodiment) for calling the function to an extended attribute setting module and a database storing module, the extended attribute setting module receives UID and PATH information transmitted by a file creating interface, the UID is converted into an application package name through a UID package name mapping relation, then the application package name is written into an extended attribute of a file corresponding to the PATH, the database storing module receives the UID and the PATH information transmitted by the file creating interface, the UID is converted into the application package name through the UID package name mapping relation, and then the application package name and the PATH are written into a database.
Therefore, the identification information of the creator can be stored and saved by adding an extended attribute key value peer-to-peer mode in the extended attribute of the file system, and the identification information can be an application package name in the Android platform. When an application creates a file, the application package name of the application is written into the extension attribute of the newly created file. Instead of recording the file path used by the application in advance, the application's information is automatically recorded into the extended attributes of the file when the application creates the file, and then the application's information is associated with the file until the file is deleted.
In this embodiment, in response to an application query request for a first reference file, a first reference application package name is obtained in an extended attribute of the first reference file, and then a preset corresponding relationship is queried according to the first reference application package name to determine a creation application of the reference file, thereby improving convenience in obtaining the creation application of the file. The preset corresponding relation stores the corresponding relation between the application package name and the corresponding application name of the created application, and the like.
In order to improve the searching speed, a database is newly built at the same time, the name of a target application package and a file creating path are recorded, the database is updated at the same time when the extension attribute is updated, the related application does not need to be modified, the function of storing related information of a file creator can be automatically realized, the information of the file creator is in a file system, the original information can still be kept by a mobile file, the database is added to store the information, all files created by a certain application can be quickly acquired, and the like.
In this embodiment, in response to a request for querying a file created by a reference application, a second reference application package name of the reference application is obtained, and then, according to a preset database, at least one second file storage path matched with the second reference application package name is obtained, and at least one second reference file is obtained according to the second file storage path, so that if all files created by a certain application need to be selected, all file paths can be directly read from the database, searching of the whole disk is avoided, and the efficiency and accuracy of obtaining the created file are improved. In this embodiment, if it is desired to obtain a certain type of file created by a certain creation application, for example, it is desired to obtain all picture files created by a certain creation application, when all files are obtained, the file type of each file may be identified, and all files of the corresponding type are selected according to the file type. In summary, in the file processing method according to the embodiment of the present disclosure, in response to a call request for a preset file creation function, an originating application identifier and a file creation path corresponding to the call request are obtained, and further, a target application package name corresponding to the originating application identifier is determined, an association relationship between the target application package name and the file creation path is constructed, and the association relationship is stored in a preset storage location. Therefore, when the file is created, the corresponding application identifier and the creation path are recorded, so that record omission of file creation is avoided, the recording efficiency is improved, in addition, the recorded actual creation path of the file is convenient for accurately determining the file creation application.
In order to implement the above embodiment, the present disclosure further proposes a file processing apparatus.
Fig. 9 is a schematic structural diagram of a file processing apparatus according to an embodiment of the present disclosure, where the apparatus may be implemented by software and/or hardware, and may be generally integrated in an electronic device. As shown in fig. 9, the apparatus includes: an acquisition module 910, a determination module 920, a construction module 930, and a storage module 940, wherein,
an obtaining module 910, configured to obtain, in response to a call request for a preset file creation function, an originating application identifier and a file creation path corresponding to the call request;
a determining module 920, configured to determine a destination application package name of the originating application identifier;
a building module 930, configured to build an association relationship between the name of the target application package and the file creation path and the target file;
and the storage module 940 is configured to store the association relationship in a preset storage location.
The file processing device provided by the embodiment of the disclosure can execute the file processing method provided by any embodiment of the disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
To achieve the above embodiments, the present disclosure also proposes a computer program product comprising a computer program/instruction which, when executed by a processor, implements the file processing method in the above embodiments.
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Referring now in particular to fig. 10, a schematic diagram of an electronic device 1000 suitable for use in implementing embodiments of the present disclosure is shown. The electronic device 1000 in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 10 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 10, the electronic device 1000 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 1001 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 1002 or a program loaded from a storage means 1008 into a Random Access Memory (RAM) 1003. In the RAM 1003, various programs and data necessary for the operation of the electronic apparatus 1000 are also stored. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other by a bus 1004. An input/output (I/O) interface 1005 is also connected to bus 1004.
In general, the following devices may be connected to the I/O interface 1005: input devices 1006 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 1007 including, for example, a Liquid Crystal Display (LCD), speaker, vibrator, etc.; storage 1008 including, for example, magnetic tape, hard disk, etc.; and communication means 1009. The communication means 1009 may allow the electronic device 1000 to communicate wirelessly or by wire with other devices to exchange data. While fig. 10 shows an electronic device 1000 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 1009, or installed from the storage device 1008, or installed from the ROM 1002. When the computer program is executed by the processing apparatus 1001, the above-described functions defined in the file processing method of the embodiment of the present disclosure are performed.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to:
and responding to a call request of a preset file creation function, acquiring an initiating application identifier and a file creation path corresponding to the call request, further determining a target application package name corresponding to the initiating application identifier, constructing an association relationship between the target application package name and the file creation path, and storing the association relationship in a preset storage position. Therefore, when the file is created, the corresponding application identifier and the creation path are recorded, so that record omission of file creation is avoided, the recording efficiency is improved, in addition, the recorded actual creation path of the file is convenient for accurately determining the file creation application.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, the present disclosure provides a file processing method, including:
responding to a call request of a preset file creation function, and acquiring an initiating application identifier and a file creation path corresponding to the call request;
determining a target application package name corresponding to the initiating application identifier;
constructing an association relationship between the name of the target application package and the file creation path;
and storing the association relation in a preset storage position.
According to one or more embodiments of the present disclosure, in the file processing method provided by the present disclosure, the determining a destination application package name corresponding to the originating application identifier includes:
inquiring a preset application package name list according to the initiating application identifier to obtain at least one reference application package name;
and if the at least one reference application package name is one, determining that the corresponding reference application package name is the target application package name. According to one or more embodiments of the present disclosure, in the file processing method provided by the present disclosure, further includes: if the at least one reference application package name is a plurality of, acquiring preset auxiliary identification information of the initiating application identification;
and determining the target application package name in a plurality of reference application package names according to the preset auxiliary identification information.
In accordance with one or more embodiments of the present disclosure, in a document processing method provided by the present disclosure,
the obtaining the originating application identifier and the file creation path corresponding to the call request includes:
acquiring an initiating application identifier and a file creation path corresponding to the call request according to the created first thread;
the obtaining the preset auxiliary identification information of the initiating application identification includes:
and acquiring thread identification information of the first thread.
According to one or more embodiments of the present disclosure, in the file processing method provided by the present disclosure, the constructing an association relationship between the target application package name and the file creation path includes:
generating a key value pair according to the target application package name and the file creation path;
the storing the association relationship in a preset storage position comprises the following steps:
acquiring a target file corresponding to the call request;
and storing the key value pairs in the extended attribute of the target file. In accordance with one or more embodiments of the present disclosure, in a document processing method provided by the present disclosure, the method further includes:
acquiring the name of the target application package and the file creation path from the constructed second thread;
And storing the association relation between the target application package name and the file creation path in a preset database through the second thread.
According to one or more embodiments of the present disclosure, in the file processing method provided by the present disclosure, further includes:
responding to an application query request of a first reference file, and acquiring a first reference application package name from the extension attribute of the first reference file;
and inquiring a preset corresponding relation according to the first reference application package name so as to determine the creation application of the reference file.
In accordance with one or more embodiments of the present disclosure, in a document processing method provided by the present disclosure,
further comprises:
responding to a file inquiry request for creating a reference application, and acquiring a second reference application package name of the reference application;
acquiring at least one second file storage path matched with the second reference application package name according to the preset database;
and acquiring at least one second reference file according to the second file storage path. According to one or more embodiments of the present disclosure, there is provided a document processing apparatus including:
the acquisition module is used for responding to a call request of a preset file creation function and acquiring an initiation application identifier and a file creation path corresponding to the call request;
The determining module is used for determining the name of the target application package of the initiating application identifier;
the construction module is used for constructing the association relationship between the name of the target application package and the file creation path and the target file;
and the storage module is used for storing the association relation in a preset storage position.
According to one or more embodiments of the present disclosure, in the document processing apparatus provided by the present disclosure, the determining module is specifically configured to:
inquiring a preset application package name list according to the initiating application identifier to obtain at least one reference application package name;
and if the at least one reference application package name is one, determining that the corresponding reference application package name is the target application package name.
According to one or more embodiments of the present disclosure, in the document processing apparatus provided by the present disclosure, the determining module is specifically configured to:
if the at least one reference application package name is a plurality of, acquiring preset auxiliary identification information of the initiating application identification;
and determining the target application package name in a plurality of reference application package names according to the preset auxiliary identification information.
According to one or more embodiments of the present disclosure, in the file processing apparatus provided by the present disclosure, the obtaining module is specifically configured to:
Acquiring an initiating application identifier and a file creation path corresponding to the call request according to the created first thread;
the obtaining the preset auxiliary identification information of the initiating application identification includes:
and acquiring thread identification information of the first thread.
According to one or more embodiments of the present disclosure, in the document processing apparatus provided by the present disclosure, the building module is further configured to:
generating a key value pair according to the target application package name and the file creation path;
the storage module is specifically configured to:
acquiring a target file corresponding to the call request;
and storing the key value pairs in the extended attribute of the target file. According to one or more embodiments of the present disclosure, in the document processing apparatus provided in the present disclosure, further includes:
the construction module is used for acquiring the name of the target application package and the file creation path from the constructed second thread;
the storage module is further configured to:
and storing the association relation between the target application package name and the file creation path in a preset database through the second thread.
According to one or more embodiments of the present disclosure, in the document processing apparatus provided in the present disclosure, further includes: an application acquisition determination module for:
Responding to an application query request of a first reference file, and acquiring a first reference application package name from the extension attribute of the first reference file;
and inquiring a preset corresponding relation according to the first reference application package name so as to determine the creation application of the reference file.
According to one or more embodiments of the present disclosure, in the document processing apparatus provided by the present disclosure, the document creation module is configured to:
responding to a file inquiry request for creating a reference application, and acquiring a second reference application package name of the reference application;
acquiring at least one second file storage path matched with the second reference application package name according to the preset database;
and acquiring at least one second reference file according to the second file storage path. According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device comprising:
a processor;
a memory for storing the processor-executable instructions;
the processor is configured to read the executable instructions from the memory and execute the instructions to implement any of the file processing methods provided in the present disclosure.
According to one or more embodiments of the present disclosure, there is provided a computer-readable storage medium storing a computer program for executing any one of the file processing methods provided by the present disclosure.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.

Claims (10)

1. A document processing method, comprising the steps of:
responding to a call request of a preset file creation function, and acquiring an initiating application identifier and a file creation path corresponding to the call request;
determining a target application package name corresponding to the initiating application identifier;
generating a key value pair according to the target application package name and the file creation path;
acquiring a target file corresponding to the call request;
and storing the key value pairs in the extended attribute of the target file.
2. The method of claim 1, wherein the determining the destination application package name to which the originating application identification corresponds comprises:
inquiring a preset application package name list according to the initiating application identifier to obtain at least one reference application package name;
and if the at least one reference application package name is one, determining that the corresponding reference application package name is the target application package name.
3. The method as recited in claim 2, further comprising:
if the at least one reference application package name is a plurality of, acquiring preset auxiliary identification information of the initiating application identification;
and determining the target application package name in a plurality of reference application package names according to the preset auxiliary identification information.
4. The method of claim 3, wherein the obtaining the originating application identification and the file creation path corresponding to the call request comprises:
acquiring an initiating application identifier and a file creation path corresponding to the call request according to the created first thread;
the obtaining the preset auxiliary identification information of the initiating application identification includes:
and acquiring thread identification information of the first thread.
5. The method of claim 1, wherein storing the key-value pairs in the extended attributes of the target file comprises:
acquiring the key value pair from the constructed second thread;
and storing the key value pairs stored in the extended attribute of the target file in a preset database through the second thread.
6. The method as recited in claim 1, further comprising:
Responding to an application query request of a first reference file, and acquiring a first reference application package name from the extension attribute of the first reference file;
and inquiring a preset corresponding relation according to the first reference application package name so as to determine the creation application of the reference file.
7. The method as recited in claim 5, further comprising:
responding to a file inquiry request for creating a reference application, and acquiring a second reference application package name of the reference application;
acquiring at least one second file storage path matched with the second reference application package name according to the preset database;
and acquiring at least one second reference file according to the second file storage path.
8. A document processing apparatus, comprising:
the acquisition module is used for responding to a call request of a preset file creation function and acquiring an initiation application identifier and a file creation path corresponding to the call request;
the determining module is used for determining the name of the target application package of the initiating application identifier;
the construction module is used for generating a key value pair according to the target application package name and the file creation path and acquiring a target file corresponding to the call request;
And the storage module is used for storing the key value pairs in the extended attribute of the target file.
9. An electronic device, the electronic device comprising:
a processor;
a memory for storing the processor-executable instructions;
the processor is configured to read the executable instructions from the memory and execute the instructions to implement the file processing method according to any one of the preceding claims 1-7.
10. A computer-readable storage medium, characterized in that the storage medium stores a computer program for executing the file processing method according to any one of the preceding claims 1-7.
CN202111652504.8A 2021-12-30 2021-12-30 File processing method, device, equipment and medium Active CN114297157B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111652504.8A CN114297157B (en) 2021-12-30 2021-12-30 File processing method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111652504.8A CN114297157B (en) 2021-12-30 2021-12-30 File processing method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN114297157A CN114297157A (en) 2022-04-08
CN114297157B true CN114297157B (en) 2024-04-09

Family

ID=80973864

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111652504.8A Active CN114297157B (en) 2021-12-30 2021-12-30 File processing method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN114297157B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105700914A (en) * 2015-12-31 2016-06-22 北京金山安全软件有限公司 Application software installation and starting method and device
CN108038114A (en) * 2017-10-17 2018-05-15 广东欧珀移动通信有限公司 A kind of path query method, terminal, computer-readable recording medium
CN108920600A (en) * 2018-06-27 2018-11-30 中国科学技术大学 A kind of metadata of distributed type file system forecasting method based on data correlation
CN110852720A (en) * 2019-11-14 2020-02-28 北京字节跳动网络技术有限公司 Document processing method, device, equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10169348B2 (en) * 2012-08-23 2019-01-01 Red Hat, Inc. Using a file path to determine file locality for applications
US10489349B2 (en) * 2015-11-04 2019-11-26 Dell Products L.P. Protecting files and folders on a shared application layer
US11334404B2 (en) * 2019-05-31 2022-05-17 Apple Inc. Techniques for managing access to file systems

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105700914A (en) * 2015-12-31 2016-06-22 北京金山安全软件有限公司 Application software installation and starting method and device
CN108038114A (en) * 2017-10-17 2018-05-15 广东欧珀移动通信有限公司 A kind of path query method, terminal, computer-readable recording medium
CN108920600A (en) * 2018-06-27 2018-11-30 中国科学技术大学 A kind of metadata of distributed type file system forecasting method based on data correlation
CN110852720A (en) * 2019-11-14 2020-02-28 北京字节跳动网络技术有限公司 Document processing method, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种获取关联程序启动路径的方法与实现;孟万化;微计算机信息;20060515(17);全文 *

Also Published As

Publication number Publication date
CN114297157A (en) 2022-04-08

Similar Documents

Publication Publication Date Title
CN111581563B (en) Page response method and device, storage medium and electronic equipment
CN112528595B (en) Document processing method and device and electronic equipment
CN111400625B (en) Page processing method and device, electronic equipment and computer readable storage medium
CN112965761B (en) Data processing method, system, electronic equipment and storage medium
CN110688353A (en) File management method, device and computer readable medium
CN112269959B (en) Control method and device for display content, readable medium and electronic equipment
US20240103928A1 (en) Information processing method and apparatus for animation resource, device, medium and product
CN111857720B (en) User interface state information generation method and device, electronic equipment and medium
CN110619096A (en) Method and apparatus for synchronizing data
CN112183045A (en) Online document processing method and device and electronic equipment
CN114637703B (en) Data access device, method, readable medium and electronic equipment
CN111694629A (en) Information display method and device and electronic equipment
CN111241823A (en) Dependency configuration management method and device, electronic equipment and storage medium
CN114328097A (en) File monitoring method and device, electronic equipment and storage medium
CN113918659A (en) Data operation method and device, storage medium and electronic equipment
CN114297157B (en) File processing method, device, equipment and medium
CN114741686A (en) Method and device for detecting program white list and related equipment
CN110377654B (en) Data request processing method and device, electronic equipment and computer-readable storage medium
CN110442403B (en) Method, device, electronic equipment and medium for calling functional component
CN110568976B (en) Method, device, equipment and storage medium for controlling application display
CN112131181A (en) Storage path display method and device and electronic equipment
CN110086880B (en) Method and apparatus for creating instances of network requests
CN111787043A (en) Data request method and device
CN110099122B (en) Method and apparatus for sending network request
CN116820354B (en) Data storage method, data storage device and data storage system

Legal Events

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