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

File processing method, device, equipment and medium Download PDF

Info

Publication number
CN114297157A
CN114297157A CN202111652504.8A CN202111652504A CN114297157A CN 114297157 A CN114297157 A CN 114297157A CN 202111652504 A CN202111652504 A CN 202111652504A CN 114297157 A CN114297157 A CN 114297157A
Authority
CN
China
Prior art keywords
file
application
package name
application package
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111652504.8A
Other languages
Chinese (zh)
Other versions
CN114297157B (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

Images

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

Abstract

The embodiment of the disclosure relates to a file processing method, a file processing 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 incidence relation between the target application package name and the file creation path; and storing the association relation in a preset storage position. Therefore, when the file is created, the corresponding application identification and the creating path are recorded, the record omission of the file creation is avoided, the recording efficiency is improved, and in addition, the recorded actual creating path of the file is convenient for accurately determining the creating application of the file.

Description

File processing method, device, equipment and medium
Technical Field
The present disclosure belongs to the field of data processing technologies, and in particular, to a file processing method, apparatus, device, and medium.
Background
As the number of applications installed on electronic devices such as smartphones increases, the number of files created by the applications is also large, and therefore, in order to manage the files, it is necessary to determine the creation application of each file in many scenarios.
In the related art, a file saving path of each application is defined and stored in advance, and further, a creating application of a corresponding file is determined according to the file saving path. For example, the file saving path for storing the video or picture of the application a in advance is as follows: and/Storage/Pictures/A, when the Storage path of a certain file is identified to be/Storage/Pictures/A, determining that the creation application of the corresponding file is an A application.
However, in the above method for determining a file creation application according to a pre-stored file saving path, a large number of file saving paths used by an application need to be recorded in advance, and a newly installed application may fail to determine a created application for a file because a corresponding file saving 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 file processing method, apparatus, device, and medium, which record corresponding application identifiers and creation paths when a file is created, avoid missing records of file creation, improve recording efficiency, and in addition, record an actual creation path of the file, which facilitates accurate determination of the creation application of the file.
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 incidence relation between the target application package name and the file creation path; and storing the association relation in a preset storage position.
An embodiment of the present disclosure further provides a file processing apparatus, where the apparatus includes: the acquisition module is used for 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; the determining module is used for determining the target application package name of the initiating application identifier; the building module is used for building the incidence relation between the target application package name 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.
An embodiment of the present disclosure further provides an electronic device, which includes: a processor; a memory for storing the processor-executable instructions; the processor is used for reading the executable instructions from the memory and executing the instructions to realize the file processing method provided by the embodiment of the disclosure.
The embodiment of the disclosure also provides a computer readable storage medium, wherein the storage medium stores a computer program, and the computer program is used for executing the file processing method provided by the embodiment of the disclosure.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages:
the file processing scheme provided by the embodiment of the disclosure is used for responding to a call request of a preset file creation function, acquiring an initiation application identifier and a file creation path corresponding to the call request, further determining a target application package name corresponding to the initiation application identifier, constructing an association relation between the target application package name and the file creation path, and storing the association relation at a preset storage position. Therefore, when the file is created, the corresponding application identification and the creating path are recorded, the record omission of the file creation is avoided, the recording efficiency is improved, and in addition, the recorded actual creating path of the file is convenient for accurately determining the creating application of the file.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
Fig. 1 is a schematic flowchart of a file processing method according to an embodiment of the disclosure;
FIG. 2 is a schematic flow chart diagram illustrating another document processing method according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram of a target application package name determining scenario provided by the embodiment of the present disclosure;
fig. 4 is a schematic view of a file processing scenario provided by an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of another document processing scenario provided by an embodiment of the present disclosure;
fig. 6 is a schematic diagram of an association relation including content according to an embodiment of the disclosure;
FIG. 7 is a schematic diagram of a database including contents 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 structural 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 present 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 are shown in the 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 rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the 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. Moreover, 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 "include" and variations thereof as used herein are 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". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
In order to solve the problems that when an application is located and created according to a file creation path which is pre-stored, a newly installed application cannot store the file creation path in time so that the created application cannot be determined, and when the application is actually created and a file is actually created, the file creation path is modified, and the created application cannot be determined, a file processing method is provided in the embodiment of the disclosure.
Fig. 1 is a flowchart illustrating a file processing method according to an embodiment of the present disclosure, where the file processing method may be executed by a file processing apparatus, where 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, responding to a call request of a preset file creation function, acquiring an originating application identifier and a file creation path.
The file creation function may be understood as a method function that needs to be called when creating a file, for example, a function such as open, mkdir, create, and the like.
In this embodiment, since the creating application calls the file creating function when creating the target file, it is first required to monitor whether the preset file creating 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 an embodiment of the present disclosure, a hook function associated with the file creation function is constructed in advance, 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, it is considered that a call request for the file creation function is obtained, and then, the corresponding file creation function is called.
In another embodiment of the present disclosure, because the created target file is inevitably stored in the preset storage space of the terminal device, a memory change of the preset storage space may be detected, when it is detected that the memory of the current preset storage space is increased, it is determined whether the memory increase value is greater than a preset threshold value, and if the memory increase value is greater than the preset threshold value, it is determined that a call request of the target file to the preset file creation function is obtained.
And secondly, responding to a call request of a preset file creation function, and acquiring an originating application identifier and a file creation path corresponding to the call request, wherein the originating application identifier can be one or more of User Identification (UID), an application name, application icon information and the like of the application.
It should be emphasized that the file creation path in the present embodiment is the actual file creation path at the time of creation of the target file, and therefore, positioning its creation application based on the file creation path ensures the accuracy of positioning.
In an 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 successfully created is monitored, for example, whether the occupation of the file creation function by the target file is removed is monitored, if the occupation is removed, the target file is considered to be successfully created, and for example, whether the target file meets a preset integrity condition is checked, and if the target file is a picture, whether the picture is completely stored is checked.
In this embodiment, if the target file is successfully created, the initiating application identifier and the file creation path of the target file are obtained through a processing function preset in the file creation function, where the processing function is a preset function that can obtain the initiating application identifier and the file creation path of the corresponding target file.
Step 102, determining a target application package name corresponding to the originating application identifier.
It should be understood that the originating application identification may not uniquely correspond to the corresponding application, for example, when the originating application identification is a UID, if there are other applications sharing the UID, it is obvious that multiple creating applications may be located based on the originating application identification.
Therefore, in this embodiment, the target application package name for creating the 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, because the application package name refers to a software package name (code namespace) and is a package designated when the application is developed, the application package name has a unique corresponding relationship with the application, and the target identification information may be the application package name, and of course, if the originating application identifier and the application are in one-to-one correspondence, the originating application identifier may also be determined as the corresponding target application package name.
In one embodiment of the present disclosure, as shown in fig. 2, determining the target application package name according to the originating application identifier includes:
step 201, querying a preset application package name list according to the originating application identifier to obtain at least one reference application package name.
In this embodiment, it is determined whether there are multiple reference application package names corresponding to the originating application identifier, and if there are multiple reference application package names, it is obvious that a unique creating application cannot be located based on the corresponding originating application identifier.
In different application scenarios, the manner of determining whether the reference application package names corresponding to the originating application identifier are multiple is different, which is exemplified as follows:
in an embodiment of the present disclosure, if the originating application identifier is the UID, it is determined whether the UID belongs to the corresponding shared UID, and in some possible embodiments, the naming rules of the package name of the file sharing the UID are different by the system, for example, for a user of the shared UID corresponding to the UID1000, the corresponding application package name is shared.
In some possible embodiments, to ensure that/data/system/packages can query the application package name of the originating application identifier, a mapping relationship between the UID and the package name may 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, at a Java layer of the system, an API function getpackagsforuid directly obtains a package name from a UID, so that a corresponding application package name can be directly obtained through getpackagsforuid, if a corresponding terminal device is an Android system, the application package name is obtained at a Native C language layer, an/data/system/packages.list file in the Android system can be queried, mapping relationships between all application package names and corresponding UIDs are stored in the application package name, and the system updates the mapping relationship when an application is installed and uninstalled, so that the method adopted in this embodiment is to start a thread monitoring/data/system/packages.list change, and if there is a change, the content of the file is refreshed and the mapping relationship between the package names are read, and a query UID interface is provided for other modules, thereby providing a service of obtaining the application package name through the UID.
In some possible implementations, the mapping stored in the packages.list may be as follows, wherein 10222, 10217, 10121 correspond to UID in the following mapping.
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 is uniquely corresponding to the application, the reference application package name can be directly determined as the target application package name.
Further, in an embodiment of the present disclosure, the method further includes:
step 203, if there are multiple reference application package names, acquiring preset auxiliary identification information of the originating application identification.
In this embodiment, if the reference application package names are multiple, the target application package name capable of uniquely locating the creation application is further determined in the multiple target applications.
As mentioned above, the application package name is identification information uniquely corresponding to the application, and therefore, in the present embodiment, if the reference application package name is multiple, the preset application package name list/data/system/packages.list is queried to obtain multiple reference application package names corresponding to multiple reference application package names.
And 204, determining a target application package name in the plurality of reference application package names according to the preset auxiliary identification information.
In this embodiment, the target application package name is screened from the multiple reference application package names according to a preset selection policy, and the target application package name is determined as the target application package name of the target file.
In this embodiment, if at least one reference application package name is multiple, preset auxiliary identification information of the originating application identification is obtained, where the preset auxiliary identification information is unique identification information corresponding to the application, and the target application package name is determined in the multiple reference application package 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 thereof are as follows:
as a possible implementation manner, when the preset auxiliary identification information is an application icon, since an application corresponding to the application icon is unique, or when the preset auxiliary identification information is an application name, the corresponding application is also unique, in this embodiment, the application icon or the application name of the originating application identifier may be obtained, and the target application package name may be obtained based on the application icon or the application name.
In this embodiment, the calling time of an application calling a preset file creation function and the request time of each application occupying a network resource to send a request in the system may be obtained, if the calling time is matched with the request time, an application icon or an application name of the corresponding application is obtained, and a target application package name is obtained according to the application icon or the application name.
As another possible implementation manner, the setting of the extended attribute needs to be completed in an independent thread, rather than directly setting the extended attribute in the file creation interface function, because the setting of the extended attribute is also an interface function for calling the file system, which generates a nested call, so that in order to avoid the nested call, a separate first thread is used in the implementation to complete the setting function of the extended attribute.
In this embodiment, since the first thread is pulled up according to the call request of the relevant application, the corresponding thread identification information corresponds to the application indication displacement, and therefore, in this embodiment, the target application package name can be uniquely determined by the thread identification information. In this embodiment, the viewable/proc/thread number/cmdline node acquires the target application packet name, the acquisition function of a PID parameter (thread identification information) may be directly added to the file creation function, and if the originating application identifier corresponds to a plurality of reference application packet names, the PID is further used to read/proc/thread number/cmdline node to acquire the target application packet name, so that the application packet name can be uniquely determined.
In still another embodiment of the present disclosure, as shown in fig. 3, multiple application icon thumbnails for the target application may also be acquired, query information including the application icon thumbnails for the multiple target applications is displayed in a form of a popup window, 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 103, constructing an association relation between the target application package name and the file creation path.
In this embodiment, an association relationship between the target application package name and the 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, and if so, the association relationship is considered to be reliable, and thus, 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 not consistent 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, the target file is conveniently subjected to virus troubleshooting, whether the target file is maliciously moved is sensed in time, or the association relationship of the target file is updated and the like, and therefore, even if the storage position of the target file is updated, the accuracy of the association relationship is not influenced.
It should be noted that, in different application scenarios, in order to facilitate location creation of an application, the association relationship may be stored in a preset storage location, or, for convenience of query, may also be directly stored in a target file in a manner of extending an attribute.
The method comprises the steps that a target application package name of a creator of a file is stored in an extended attribute of the target file, the target application package name is unique in an Android system and can identify the application, if a terminal device is a Linux file system, a mechanism is provided for the corresponding extended attribute of the terminal device and is used for permanently associating Key value pairs to the target file, the extended attribute can be used for adding additional Key-value Key value pairs to the file, and the keys and the values are character strings and have certain length limitation. 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 or not, and relevant support such as an extended attribute namespace is required. File systems including btrfs, ext2, ext3, ext4, f2fs, JFS, Reiserfs, Lustrefs, and XFS all support EA. And the support of various file systems for the extended property is optional.
For example, if the system of the terminal device is Android 11, since the underlying file system of the Android 11 employs F2FS, this file system may already support extended attributes, for example, extended attributes such as user.xxx may be defined to complete some functions. However, in the Android system, all applications cannot directly access the F2FS file system, but two overlap sdcardfs and FUSE file systems are added on the F2FS file system, and FUSE is above sdcardfs. Within the platform's existing code, neither sdcardfs nor fuse file systems support extended attributes, and existing extended attribute permission checking mechanisms do not allow sdcardfs and fuse access, the extended attribute of user. Therefore, the following functions need to be implemented in this example: the package is used to store the name of the application package, the access rule of the attribute of trans is added, the attribute of trans is allowed to access across the file system, and the Fuse, sdcardfs and f2fs can all access the attribute of trans, in addition, in this embodiment, an extended attribute operation function of sdcardfs and Fuse file systems is also needed to be implemented, the actual storage of the extended attribute is in the f2fs file system, and the extended attribute correlation interfaces implemented by sdcardfs and Fuse file systems are all functions of transparent transmission forwarding, where, as shown in fig. 4, the Fuse layer accesses the sdcardfs layer and the sdcardfs layer accesses the f2fs layer.
In an 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 application requests for creating files may be arranged in a form of a message queue.
Therefore, in the embodiment, a key-value pair is generated according to the target application package name and the file creation path, wherein, as shown in fig. 6, the key may correspond to the target application package name, and the value corresponds to the file creation path, and the key-value pair is stored in the extended attribute of the target file, so that each target file carries a corresponding created application tag, thereby improving the efficiency of locating the created application.
And 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 separately stored in a related database.
In an embodiment of the present disclosure, in order to further facilitate obtaining of a corresponding target file, the surface traverses all files in the 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 the target file may be obtained according to the correspondence relationship based on the database, so that the target file is quickly searched and obtained. The storage of the database and the setting of the extended attribute also need to be finished in an independent second thread, and the processing flow is also the same, but the final result is to write the target application package name and the file creation path into the database.
In some possible embodiments, as shown in fig. 7, each row in the preset database stores a corresponding target application package name package and a file creation path, a path of the target file may be quickly determined based on the corresponding target application package name package, the target file may be quickly found according to the path of the target file, and operations such as downloading the target file may be implemented.
Therefore, as shown in fig. 8, in the embodiment of the present disclosure, the scheme includes a file creation interface module, an extended attribute setting module, a database saving module, and the like, where the file creation interface module is a file creation function for creating various files and folders provided by the file system, and includes open, mkdir, create, and the like, and the scheme needs to add a processing function into an interface of these file creation functions. The processing function is to send the initiation application identifier (UID in the embodiment) and the file creation PATH (PATH in the embodiment) calling the function to the extended attribute setting module and the database storage module, the extended attribute setting module receives the UID and PATH information transmitted by the file creation interface, the UID is converted into an application package name through the UID package name mapping relation, then the application package name is written into the extended attribute of the file corresponding to the PATH, the database storage module receives the UID and PATH information transmitted by the file creation 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 both written into the database.
Therefore, the identification information of the creator can be stored and saved in a peer-to-peer mode of adding an extended attribute key value in the extended attribute of the file system, and the identification information can be the name of the application package on the Android platform. When a file is created by an application, the application package name of the application is written into the extended attribute of the newly created file. Instead of recording the file path used by the application in advance, the information of the application is automatically recorded into the extended attribute of the file when the application creates the file, and then the information of the application 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 from 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 created application of the reference file, so that convenience in obtaining the created application of the file is improved. The preset corresponding relation stores the corresponding relation between the application package name and the corresponding application name for creating the application.
In order to improve the searching speed, a database is newly established at the same time, the package name of a target application and a file creating path are recorded, the database is updated at the same time when the extended attribute is updated, the function of saving the related information of a file creator can be automatically realized without any modification on related applications, the information of the file creator is in a file system, original information can still be kept by moving files, the original information can be added into the database to save the information, all files created by a certain application can be quickly obtained, and the like.
In this embodiment, in response to a query request for a file to be created for 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 an application need to be selected, all file paths can be directly read from the database, searching for a whole disk is avoided, and acquisition efficiency and accuracy of the created file are improved. In this embodiment, if it is desired to acquire a certain type of file created by a certain creating application, for example, it is desired to acquire all picture files created by a certain creating application, when all files are acquired, the file type of each file may also be identified, and all files of the corresponding type are screened out according to the file type. In summary, the file processing method according to the embodiment of the present disclosure, in response to a call request for a preset file creation function, obtains an originating application identifier and a file creation path corresponding to the call request, further determines a target application package name corresponding to the originating application identifier, constructs an association relationship between the target application package name and the file creation path, and stores the association relationship in a preset storage location. Therefore, when the file is created, the corresponding application identification and the creating path are recorded, the record omission of the file creation is avoided, the recording efficiency is improved, and in addition, the recorded actual creating path of the file is convenient for accurately determining the creating application of the file.
In order to implement the above embodiments, the present disclosure also provides a file processing apparatus.
Fig. 9 is a schematic structural diagram of a file processing apparatus provided in 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 obtaining module 910, a determining module 920, a constructing module 930, and a storing module 940, wherein,
an obtaining module 910, configured to respond to a call request for a preset file creation function, and obtain an originating application identifier and a file creation path corresponding to the call request;
a determining module 920, configured to determine a target application package name of the originating application identifier;
a building module 930, configured to build an association relationship between the target application package name and the file creation path and the target file;
a storage module 940, 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 corresponding functional modules and beneficial effects of the execution method.
In order to implement the above embodiments, the present disclosure also proposes a computer program product comprising a computer program/instructions 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 present disclosure.
Referring now specifically 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 a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle-mounted terminal (e.g., a car navigation terminal), and the like, and fixed terminals such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 10 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
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.
Generally, the following devices may be connected to the I/O interface 1005: input devices 1006 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 1007 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 1008 including, for example, magnetic tape, hard disk, and the like; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange data. While fig. 10 illustrates an electronic device 1000 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 1009, or installed from the storage means 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 executed.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination 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 present 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 contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications 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 network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled 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:
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 incidence relation between the target application package name and the file creation path, and storing the incidence relation in a preset storage position. Therefore, when the file is created, the corresponding application identification and the creating path are recorded, the record omission of the file creation is avoided, the recording efficiency is improved, and in addition, the recorded actual creating path of the file is convenient for accurately determining the creating application of the file.
Computer program code for carrying out operations for the present disclosure may be written in any combination of 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 type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart 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 described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above 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: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), 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. A 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, there is provided 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 incidence relation between the target application package name 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 target 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, the file processing method provided by the present disclosure further includes: if the at least one reference application package name is multiple, acquiring preset auxiliary identification information of the initiating application identification;
and determining the target application package name in the plurality of reference application package names according to the preset auxiliary identification information.
According to one or more embodiments of the present disclosure, in a document processing method provided by the present disclosure,
the obtaining of the originating application identifier and the file creation path corresponding to the call request includes:
acquiring an initiating application identifier and a file creating path corresponding to the calling request according to the created first thread;
the acquiring of the preset auxiliary identification information of the application identification includes:
and acquiring the 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 location includes:
acquiring a target file corresponding to the calling request;
and storing the key-value pair in the extended attribute of the target file. According to one or more embodiments of the present disclosure, in a file 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 incidence 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, 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 in the extended attribute of the first reference file;
and inquiring a preset corresponding relation according to the first reference application package name to determine the creation application of the reference file.
According to one or more embodiments of the present disclosure, in a document processing method provided by the present disclosure,
further comprising:
responding to a file creating query request of 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 initiating application identifier and a file creation path corresponding to the call request;
the determining module is used for determining the target application package name of the initiating application identifier;
the building module is used for building the incidence relation between the target application package name 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 file 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 file processing apparatus provided by the present disclosure, the determining module is specifically configured to:
if the at least one reference application package name is multiple, acquiring preset auxiliary identification information of the initiating application identification;
and determining the target application package name in the 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 creating path corresponding to the calling request according to the created first thread;
the acquiring of the preset auxiliary identification information of the application identification includes:
and acquiring the 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 calling request;
and storing the key-value pair in the extended attribute of the target file. According to one or more embodiments of the present disclosure, the document processing apparatus further includes:
the building module is used for acquiring the target application package name and the file creating path from a built second thread;
the storage module is further configured to:
and storing the incidence 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, the document processing apparatus further includes: an application acquisition determination module to:
responding to an application query request of a first reference file, and acquiring a first reference application package name in the extended attribute of the first reference file;
and inquiring a preset corresponding relation according to the first reference application package name to determine the creation application of the reference file.
According to one or more embodiments of the present disclosure, in a document processing apparatus provided by the present disclosure, the document creation module is configured to:
responding to a file creating query request of 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. In accordance with one or more embodiments of the present disclosure, there is provided an electronic device including:
a processor;
a memory for storing the processor-executable instructions;
the processor is used for reading the executable instructions from the memory and executing the instructions to realize the file processing method provided by the 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 the file processing method according to any one of the file processing methods provided by the present disclosure.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while 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. Under 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 limitations on the scope of the 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 disclosed as example forms of implementing the claims.

Claims (11)

1. A file 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;
constructing an incidence relation between the target application package name and the file creation path;
and storing the association relation in a preset storage position.
2. The method of claim 1, wherein the determining the target application package name corresponding to the originating application identification 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 of claim 2, further comprising:
if the at least one reference application package name is multiple, acquiring preset auxiliary identification information of the initiating application identification;
and determining the target application package name in the 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 identifier and the file creation path corresponding to the invocation request comprises:
acquiring an initiating application identifier and a file creating path corresponding to the calling request according to the created first thread;
the acquiring of the preset auxiliary identification information of the application identification includes:
and acquiring the thread identification information of the first thread.
5. The method of claim 1, wherein said constructing the association of the target application package name and the file creation path comprises:
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 location includes:
acquiring a target file corresponding to the calling request;
and storing the key-value pair in the extended attribute of the target file.
6. The method of claim 1, wherein said storing the association at a predetermined storage location comprises:
acquiring the name of the target application package and the file creation path from the constructed second thread; and storing the incidence relation between the target application package name and the file creation path in a preset database through the second thread.
7. The method of claim 5, further comprising:
responding to an application query request of a first reference file, and acquiring a first reference application package name in the extended attribute of the first reference file;
and inquiring a preset corresponding relation according to the first reference application package name to determine the creation application of the reference file.
8. The method of claim 6, further comprising:
responding to a file creating query request of 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.
9. A document processing apparatus, characterized by comprising:
the acquisition module is used for 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;
the determining module is used for determining the target application package name of the initiating application identifier;
the building module is used for building the incidence relation between the target application package name 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.
10. An electronic device, characterized in that the electronic device comprises:
a processor;
a memory for storing the processor-executable instructions;
the processor is used for reading the executable instructions from the memory and executing the instructions to realize the file processing method of any one of the claims 1 to 8.
11. A computer-readable storage medium, characterized in that the storage medium stores a computer program for executing the file processing method of any one of claims 1 to 8.
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 true CN114297157A (en) 2022-04-08
CN114297157B 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 (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140059094A1 (en) * 2012-08-23 2014-02-27 Red Hat, Inc. Making use of a file path to determine file locality for applications
CN105700914A (en) * 2015-12-31 2016-06-22 北京金山安全软件有限公司 Application software installation and starting method and device
US20170124105A1 (en) * 2015-11-04 2017-05-04 Dell Products L.P. Protecting files and folders on a shared application layer
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
US20200379828A1 (en) * 2019-05-31 2020-12-03 Apple Inc. Techniques for managing access to file systems

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140059094A1 (en) * 2012-08-23 2014-02-27 Red Hat, Inc. Making use of a file path to determine file locality for applications
US20170124105A1 (en) * 2015-11-04 2017-05-04 Dell Products L.P. Protecting files and folders on a shared application layer
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
US20200379828A1 (en) * 2019-05-31 2020-12-03 Apple Inc. Techniques for managing access to file systems
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
孟万化: "一种获取关联程序启动路径的方法与实现", 微计算机信息, no. 17, 15 May 2006 (2006-05-15) *

Also Published As

Publication number Publication date
CN114297157B (en) 2024-04-09

Similar Documents

Publication Publication Date Title
CN111581563B (en) Page response method and device, storage medium and electronic equipment
US9344433B2 (en) Unregistered user account generation for content item sharing
CN112528595B (en) Document processing method and device and electronic equipment
CN104427395A (en) Electronic device and method for using captured image in electronic device
TW201814545A (en) Multi-service integration method and apparatus, intelligent terminal, server and operating system
CN111400625B (en) Page processing method and device, electronic equipment and computer readable storage medium
CN107103011B (en) Method and device for realizing terminal data search
CN110619096A (en) Method and apparatus for synchronizing data
CN110688353A (en) File management method, device and computer readable medium
CN112183045A (en) Online document processing method and device and electronic equipment
CN111694629A (en) Information display method and device and electronic equipment
CN114328097A (en) File monitoring method and device, electronic equipment and storage medium
CN113918659A (en) Data operation method and device, storage medium and electronic equipment
CN110619101B (en) Method and apparatus for processing information
CN114297157B (en) File processing method, device, equipment and medium
KR20140135114A (en) Information processing apparatus, and control method therefor
CN114417782A (en) Display method and device and electronic equipment
CN110568976B (en) Method, device, equipment and storage medium for controlling application display
CN112131181A (en) Storage path display method and device and electronic equipment
CN108399223B (en) Data acquisition method and device and electronic equipment
CN111787043A (en) Data request method and device
CN112149019A (en) Method, apparatus, electronic device, and computer-readable medium for displaying information
CN112732457A (en) Image transmission method, image transmission device, electronic equipment and computer readable medium
US20140344352A1 (en) Activity internet-accessible data storage view that shows recent and relevant content to the user
CN112256654A (en) Document sharing method and device

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