File sharing method and apparatus, computer device, and storage medium

By establishing mutual trust relationships and a distributed file system between devices, the problem of file sharing between different applications on different devices is solved, and efficient cross-device file access is achieved.

CN115774700BActive Publication Date: 2026-05-01深圳开鸿数字产业发展有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
深圳开鸿数字产业发展有限公司
Filing Date
2022-11-17
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing technologies cannot enable file sharing between different devices and applications, resulting in inefficient file access.

Method used

By establishing mutual trust between devices, and utilizing a distributed file system and file access interface, cross-device and cross-application file sharing can be achieved. Specific steps include establishing a public file directory, modifying permissions, obtaining metadata information, and displaying files.

Benefits of technology

It enables file sharing between different applications and improves the efficiency of accessing files across devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115774700B_ABST
    Figure CN115774700B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of Internet, and particularly discloses a file sharing method, device, equipment and storage medium. The method comprises the following steps: when detecting that a second application opens a second file directory, calling a file access interface to realize that the second application accesses a public file directory; based on the public file directory, reading metadata information of a first file directory of a first application, and sending the metadata information to the second file directory to realize file sharing between applications. The method can realize file sharing between different applications, and improve the access efficiency of cross-device file access.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of file sharing technology, and in particular to a file sharing method, apparatus, computer equipment, and storage medium. Background Technology

[0002] In many scenarios such as office work and industrial maintenance, there is a great demand for cross-device file sharing. Currently, file sharing between devices can be achieved through the cloud storage function of the same application. This requires uploading files to the cloud of one application and then downloading them from the cloud of the same application on another device to the local device. It does not enable file sharing between different applications on different devices, which greatly reduces file access efficiency. Therefore, how to improve file access efficiency has become an urgent problem to be solved. Summary of the Invention

[0003] This application provides a file sharing method, apparatus, computer device, and storage medium to improve the efficiency of accessing files across devices.

[0004] Firstly, this application provides a file sharing method, the method comprising:

[0005] When the second application is detected to have opened the second file directory, the file access interface is called to enable the second application to access the public file directory.

[0006] Based on the public file directory, the metadata information of the first file directory of the first application is read, and the metadata information is sent to the second file directory to realize file sharing between applications.

[0007] Furthermore, before calling the file access interface to enable the second application to access the public file directory upon detecting that the second application has opened the second file directory, the method further includes:

[0008] Create the first file directory for the first application in the first device, and create the second file directory for the second application in the second device;

[0009] Create a mount directory, create a distributed file system directory within the mount directory, and create the public file directory based on the distributed file system directory;

[0010] Associate the first file directory with the public file directory.

[0011] Furthermore, after establishing the mount directory, creating a distributed file system directory within the mount directory, and creating the public file directory based on the distributed file system directory, the process further includes:

[0012] Change the file type of the distributed file system directory to system files, and change the access permissions of the public file directory to open access.

[0013] Furthermore, the step of calling the file access interface to enable the second application to access the public file directory when the second application is detected to have opened the second file directory includes:

[0014] When the second application is detected to have opened the second file directory, a file access request for the second application to access the first file directory is generated, and the file management module is invoked to send the file access request to the first application;

[0015] When the first application receives the file access request, it calls the file access interface to enable the second application to access the public file directory.

[0016] Furthermore, the step of reading metadata information from the first file directory of the first application based on the public file directory and sending the metadata information to the second file directory to achieve file sharing between applications includes:

[0017] Based on the mutual trust relationship between the first device and the second device and the public file directory, the metadata information is obtained;

[0018] The metadata information is sent to the second file directory. Based on the metadata information, the files in the first file directory are displayed to the user through the second file directory, thereby realizing file sharing between applications.

[0019] Furthermore, before obtaining the metadata information based on the mutual trust relationship between the first device and the second device and the public file directory, the process further includes:

[0020] Based on the constraint application protocol, the mutual trust relationship is established between the first device and the second device.

[0021] Furthermore, after reading the metadata information of the first application's first file directory based on the public file directory and sending the metadata information to the second file directory to achieve file sharing between applications, the method further includes:

[0022] Based on user actions, update and save the files in the first file directory and the first file directory itself.

[0023] Secondly, this application also provides a file sharing device, the device comprising:

[0024] The public file directory access module is used to call the file access interface when it is detected that a second application has opened a second file directory, so as to enable the second application to access the public file directory;

[0025] The file sharing module is used to read the metadata information of the first file directory of the first application based on the public file directory, and send the metadata information to the second file directory to realize file sharing between applications.

[0026] Thirdly, this application also provides a computer device, the computer device including a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and implement the file sharing method as described above when executing the computer program.

[0027] Fourthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the file-sharing method described above.

[0028] This application discloses a file-sharing method, apparatus, computer device, and storage medium. When a second application is detected to have opened a second file directory, a file access interface is invoked to allow the second application to access a public file directory. Based on the public file directory, metadata information of the first application's first file directory is read and sent to the second file directory, thus achieving file sharing between applications. This method allows a second application to access a public file directory through the file access interface while accessing its own file directory. Through the public file directory, relevant data from the first file directory can be obtained, enabling file sharing between different applications and improving the efficiency of cross-device file access. Attached Figure Description

[0029] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 This is a schematic flowchart of a first embodiment of a file sharing method provided in this application;

[0031] Figure 2 This is a schematic flowchart of a second embodiment of a file sharing method provided in this application;

[0032] Figure 3 This is a schematic flowchart of a third embodiment of a file sharing method provided in this application;

[0033] Figure 4This is a schematic flowchart of a fourth embodiment of a file sharing method provided in this application;

[0034] Figure 5 A schematic block diagram of a file sharing device provided for embodiments of this application;

[0035] Figure 6 A schematic block diagram of the structure of a computer device provided for an embodiment of this application. Detailed Implementation

[0036] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0037] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.

[0038] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0039] It should also be understood that the term "and / or" as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0040] Embodiments of this application provide a file sharing method, apparatus, computer device, and storage medium. The file sharing method can be applied to a server, enabling file sharing between different applications and thereby improving the efficiency of cross-device file access. The server can be a standalone server or a server cluster.

[0041] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0042] Please see Figure 1 , Figure 1This is a schematic flowchart illustrating a file-sharing method provided in an embodiment of this application. This file-sharing method can be applied to a server to enable file sharing between different applications, thereby improving the efficiency of cross-device file access.

[0043] like Figure 1 As shown, the file sharing method specifically includes steps S101 to S102.

[0044] S101. When it is detected that the second application has opened the second file directory, the file access interface is called to enable the second application to access the public file directory.

[0045] In one embodiment, the current open-source HarmonyOS does not support cross-device and cross-application file access (distributed files). To achieve cross-device and cross-application distributed file access, it is necessary to rely on the open-source HarmonyOS's file management, soft bus capabilities, distributed file system, and basic framework capabilities.

[0046] In one embodiment, the first application and the second application are different applications on different devices, with the second application being an application on the second device. The first device and the second device establish a mutual trust relationship based on a distributed soft bus, and a network communication mechanism is established during the connection process between the two devices.

[0047] In one embodiment, a second file directory is created for the second application in the second device. After the second application on the second device starts, it accesses the distributed public file directory through the file access interface of the file management module when opening the second file directory.

[0048] S102. Based on the public file directory, read the metadata information of the first file directory of the first application and send the metadata information to the second file directory to realize file sharing between applications.

[0049] In one embodiment, the HMDFS feature is triggered when the second application accesses the second file directory, using a network communication mechanism to retrieve metadata information of the first file directory from the first device. After obtaining the metadata information, the second device can display the file information in the first file directory to the user through the second file directory. The user can then directly read files on the first device through the second application on the second device, realizing cross-application file sharing between devices.

[0050] HMDFS (HarmonyOS Distributed File System) provides a variety of file system capabilities, including: file type aggregation, efficient cache management, batch processing interface, distributed permission control, efficient transmission, and data consistency management.

[0051] Based on the public file directory, the metadata information of the first file directory of the first application is read and the metadata information is sent to the second file directory to realize file sharing between applications. The method further includes: updating and saving the files in the first file directory and the first file directory according to user operations.

[0052] In one embodiment, if a user modifies a file in the first file directory or adds a new file to the directory in the second application, the modified directory or file is updated and saved after the user's operation is completed.

[0053] The file-sharing method, apparatus, computer device, and storage medium provided in the above embodiments, when detecting that a second application has opened a second file directory, invoke a file access interface to enable the second application to access a public file directory; based on the public file directory, read the metadata information of the first application's first file directory, and send the metadata information to the second file directory, thereby realizing file sharing between applications. This method allows the second application to access the public file directory through the file access interface when accessing its file directory, and obtain relevant data from the first file directory through the public file directory, thus realizing file sharing between different applications and improving the efficiency of cross-device file access.

[0054] Please see Figure 2 , Figure 2 This is a schematic flowchart illustrating a file-sharing method provided in an embodiment of this application. This file-sharing method can be applied to a server to enable file sharing between different applications, thereby improving the efficiency of cross-device file access.

[0055] like Figure 2 As shown, before step S101 of the file sharing method, steps S201 to S203 are also included.

[0056] S201. Create the first file directory for the first application in the first device, and create the second file directory for the second application in the second device.

[0057] In one embodiment, the first application and the second application are not the same type of application and are not on the same device. An application file directory, i.e., the first file directory, is created for the first application on the first device, and an application file directory, i.e., the second file directory, is created for the second application on the second device.

[0058] S202. Create a mount directory, create a distributed file system directory in the mount directory, and create the public file directory based on the distributed file system directory.

[0059] After establishing a mount directory, creating a distributed file system directory within the mount directory, and then creating a public file directory based on the distributed file system directory, the process further includes: changing the file type of the distributed file system directory to system files, and changing the access permissions of the public file directory to open access.

[0060] In one embodiment, after the first device starts up, a mount directory is created, and a distributed file system directory is created under the mount directory, and a public file directory is created in the distributed file system directory.

[0061] In one embodiment, after the public file directory is created, its directory permissions are modified to 777. 777 permissions mean that the current user can read, write, and execute the corresponding files, i.e., have open access. The file type of the distributed file system directory is then changed to system files.

[0062] S203. Associate the first file directory with the public file directory.

[0063] In one embodiment, after the application incubator component starts the first application, it associates the first file directory with the public file directory via mount, thus associating the application sandbox and the public file directory.

[0064] The kernel-level application sandbox involves the kernel using standard Linux mechanisms (such as user IDs and group IDs assigned to applications) at the process level to ensure security between applications and the system. By default, applications cannot interact with each other, and their access permissions to the operating system are restricted. For example, if application A (a standalone application) attempts to perform malicious operations, such as reading data from application B or making a phone call without permission, the operating system will prevent such behavior because application A does not have the appropriate user permissions. This sandbox mechanism is auditable and based on decades-old UNIX-style process user isolation and file permission mechanisms.

[0065] The file sharing method, apparatus, computer device, and storage medium provided in the above embodiments establish a first file directory for a first application in a first device and a second file directory for a second application in a second device; establish a mount directory, create a distributed file system directory within the mount directory, and establish a public file directory based on the distributed file system directory; and associate the first file directory with the public file directory. This method allows the second application to access its file directory and, through a file access interface, access the public file directory. The public file directory then provides access to relevant data from the first file directory, enabling file sharing between different applications and improving the efficiency of cross-device file access.

[0066] Please see Figure 3 , Figure 3 This is a schematic flowchart illustrating a file-sharing method provided in an embodiment of this application. This file-sharing method can be applied to a server to enable file sharing between different applications, thereby improving the efficiency of cross-device file access.

[0067] like Figure 3 As shown, step S101 of the file sharing method specifically includes steps S301 to S302.

[0068] S301. When it is detected that the second application has opened the second file directory, a file access request for the second application to access the first file directory is generated, and the file management module is invoked to send the file access request to the first application.

[0069] In one embodiment, when the second application accesses the second file directory, an access request to access the first file directory is automatically generated, and the file management module sends the access request to the first application.

[0070] S302. When the first application receives the file access request, it calls the file access interface to enable the second application to access the public file directory.

[0071] In one embodiment, when the first application receives an access request, it utilizes HMDFS features to obtain metadata information of the first file directory from the first device via a network communication mechanism. After obtaining the metadata information, the second device can display the file information in the first file directory to the user through the second file directory. The user can then directly read files on the first device through the second application on the second device, thus realizing cross-application file sharing across devices.

[0072] The file sharing method, apparatus, computer device, and storage medium provided in the above embodiments, when detecting that the second application has opened the second file directory, generate a file access request for the second application to access the first file directory, and call the file management module to send the file access request to the first application; when the first application receives the file access request, it calls the file access interface to enable the second application to access the public file directory. This method allows the second application to access the public file directory through the file access interface when accessing its own file directory, and to obtain relevant data from the first file directory through the public file directory, thus realizing file sharing between different applications and improving the efficiency of cross-device file access.

[0073] Please see Figure 4 , Figure 4 This is a schematic flowchart illustrating a file-sharing method provided in an embodiment of this application. This file-sharing method can be applied to a server to enable file sharing between different applications, thereby improving the efficiency of cross-device file access.

[0074] like Figure 4 As shown, step S102 of the file sharing method specifically includes steps S401 to S402.

[0075] S401. Based on the mutual trust relationship between the first device and the second device and the public file directory, obtain the metadata information.

[0076] In one embodiment, the first device and the second device have established a mutual trust relationship. Both the first file directory and the second file directory belong to the distributed file system type. When the two devices establish a mutual trust relationship, the hmdfs module will establish a network communication mechanism. Through the network communication mechanism, the metadata information of the first file directory under the first device can be obtained from the public file directory.

[0077] Before obtaining the metadata information based on the mutual trust relationship between the first device and the second device and the public file directory, the method further includes: establishing the mutual trust relationship between the first device and the second device based on the constraint application protocol.

[0078] In one embodiment, based on soft bus technology, two devices discover other devices and form a super device network through the coap (Constrained Application Protocol). The two devices then propose a connection and establish a mutual trust relationship.

[0079] CoAP (Constrained Application Protocol) is an Internet application protocol specifically designed for constrained devices. It enables constrained devices, referred to as "nodes," to communicate with the wider Internet using similar protocols. CoAP is designed for use between devices on the same constrained network (e.g., low-power, lossy networks), between devices and general nodes on the Internet, and between devices on different constrained networks connected by the Internet. CoAP is also used in other mechanisms, such as SMS (Short Message Service) on mobile communication networks.

[0080] S402. Send the metadata information to the second file directory. Based on the metadata information, display the files in the first file directory to the user through the second file directory to realize file sharing between applications.

[0081] In one embodiment, the system sends metadata information to the second device. Based on the metadata information, the system can read the files in the first file directory in the second file directory of the second device. The user can then directly read the files in the first device through the second application of the second device, thus realizing cross-device and cross-application file sharing.

[0082] The file sharing method, apparatus, computer device, and storage medium provided in the above embodiments obtain metadata information based on the mutual trust relationship between the first device and the second device and the public file directory; send the metadata information to the second file directory; and, based on the metadata information, display the files in the first file directory to the user through the second file directory, thereby realizing file sharing between applications. This method allows the second application to access the public file directory through a file access interface when accessing its file directory, and obtain relevant data from the first file directory through the public file directory, thus realizing file sharing between different applications and improving the efficiency of cross-device file access.

[0083] Please see Figure 5 , Figure 5 This is a schematic block diagram of a file-sharing device provided in an embodiment of this application. This file-sharing device is used to execute the aforementioned file-sharing method. The file-sharing device can be configured on a server.

[0084] like Figure 5 As shown, the file sharing device 400 includes:

[0085] The public file directory access module 401 is used to call the file access interface when it is detected that the second application has opened the second file directory, so as to enable the second application to access the public file directory;

[0086] The file sharing module 402 is used to read the metadata information of the first file directory of the first application based on the public file directory, and send the metadata information to the second file directory to realize file sharing between applications.

[0087] In one embodiment, the file sharing device 400 further includes a directory association module, the directory association module comprising:

[0088] An application file directory creation unit is used to create the first file directory for a first application in a first device and to create the second file directory for a second application in a second device;

[0089] A public file directory creation unit is used to create a mount directory, in which a distributed file system directory is created, and based on the distributed file system directory, the public file directory is created.

[0090] The directory association unit is used to associate the first file directory with the public file directory.

[0091] In one embodiment, the directory association module further includes:

[0092] The directory attribute definition unit is used to modify the file type of the distributed file system directory to system files and modify the access permissions of the public file directory to open access.

[0093] In one embodiment, the public file directory access module 401 includes:

[0094] An access request sending unit is configured to generate a file access request for the second application to access the first file directory when the second application is detected to have opened the second file directory, and to call the file management module to send the file access request to the first application;

[0095] The file directory access unit is used to call the file access interface when the first application receives the file access request, so as to enable the second application to access the public file directory.

[0096] In one embodiment, the file sharing module 402 includes:

[0097] Metadata information acquisition unit, used to acquire the metadata information based on the mutual trust relationship between the first device and the second device and the public file directory;

[0098] The file sharing unit is used to send the metadata information to the second file directory, and based on the metadata information, display the files in the first file directory to the user through the second file directory, thereby realizing file sharing between applications.

[0099] In one embodiment, the file sharing module 402 further includes:

[0100] The mutual trust relationship establishment unit is used to establish the mutual trust relationship between the first device and the second device based on the constraint application protocol.

[0101] In one embodiment, the file sharing device 400 further includes a file update module, the file update module comprising:

[0102] The file update unit is used to update and save the files in the first file directory and the first file directory according to user operations.

[0103] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the above-described apparatus and modules can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0104] The aforementioned device can be implemented as a computer program, which can be used in, for example... Figure 6 It runs on the computer device shown.

[0105] Please see Figure 6 , Figure 6 This is a schematic block diagram illustrating the structure of a computer device according to an embodiment of this application. The computer device may be a server.

[0106] See Figure 6 The computer device includes a processor, memory, and network interface connected via a system bus, wherein the memory may include non-volatile storage media and internal memory.

[0107] Non-volatile storage media can store operating systems and computer programs. These computer programs include program instructions that, when executed, cause the processor to perform any file-sharing method.

[0108] The processor provides computing and control capabilities, supporting the operation of the entire computer device.

[0109] Internal memory provides an environment for the execution of computer programs on non-volatile storage media, which, when executed by a processor, enable the processor to perform any file-sharing method.

[0110] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0111] It should be understood that the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.

[0112] In one embodiment, the processor is configured to run a computer program stored in memory to perform the following steps:

[0113] When the second application is detected to have opened the second file directory, the file access interface is called to enable the second application to access the public file directory.

[0114] Based on the public file directory, the metadata information of the first file directory of the first application is read, and the metadata information is sent to the second file directory to realize file sharing between applications.

[0115] In one embodiment, before the processor calls the file access interface to enable the second application to access the public file directory upon detecting that the second application has opened the second file directory, it is further configured to implement:

[0116] Create the first file directory for the first application in the first device, and create the second file directory for the second application in the second device;

[0117] Create a mount directory, create a distributed file system directory within the mount directory, and create the public file directory based on the distributed file system directory;

[0118] Associate the first file directory with the public file directory.

[0119] In one embodiment, after the processor establishes the mount directory, creates a distributed file system directory within the mount directory, and creates the public file directory based on the distributed file system directory, it is further configured to:

[0120] Change the file type of the distributed file system directory to system files, and change the access permissions of the public file directory to open access.

[0121] In one embodiment, when the processor detects that a second application has opened a second file directory and calls the file access interface to enable the second application to access the public file directory, it is configured to:

[0122] When the second application is detected to have opened the second file directory, a file access request for the second application to access the first file directory is generated, and the file management module is invoked to send the file access request to the first application;

[0123] When the first application receives the file access request, it calls the file access interface to enable the second application to access the public file directory.

[0124] In one embodiment, when the processor reads metadata information from the first file directory of the first application based on the public file directory and sends the metadata information to the second file directory to achieve file sharing between applications, it is configured to:

[0125] Based on the mutual trust relationship between the first device and the second device and the public file directory, the metadata information is obtained;

[0126] The metadata information is sent to the second file directory. Based on the metadata information, the files in the first file directory are displayed to the user through the second file directory, thereby realizing file sharing between applications.

[0127] In one embodiment, before the processor obtains the metadata information based on the mutual trust relationship between the first device and the second device and the public file directory, it is further configured to:

[0128] Based on the constraint application protocol, the mutual trust relationship is established between the first device and the second device.

[0129] In one embodiment, after the processor implements reading metadata information from the first file directory of the first application based on the public file directory and sending the metadata information to the second file directory to achieve file sharing between applications, it is further configured to implement:

[0130] Based on user actions, update and save the files in the first file directory and the first file directory itself.

[0131] The embodiments of this application also provide a computer-readable storage medium storing a computer program, the computer program including program instructions, and the processor executing the program instructions to implement any of the file sharing methods provided in the embodiments of this application.

[0132] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiments, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, smart memory card (SMC), secure digital card (SD), flash memory card, etc., provided on the computer device.

[0133] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A file sharing method, characterized in that, include: When the second application is detected to have opened the second file directory, the file access interface is called to enable the second application to access the public file directory. Based on the public file directory, the metadata information of the first file directory of the first application is read, and the metadata information is sent to the second file directory to realize file sharing between applications; The step of calling the file access interface to enable the second application to access the public file directory when the second application is detected to have opened the second file directory also includes: Create the first file directory for the first application in the first device, and create the second file directory for the second application in the second device; Create a mount directory, create a distributed file system directory within the mount directory, and create the public file directory based on the distributed file system directory; Associate the first file directory with the public file directory.

2. The file sharing method according to claim 1, characterized in that, The process of establishing a mount directory, creating a distributed file system directory within that mount directory, and then creating the public file directory based on that distributed file system directory, further includes: Change the file type of the distributed file system directory to system files, and change the access permissions of the public file directory to open access.

3. The file sharing method according to claim 1, characterized in that, The step of calling the file access interface when the second application is detected to open the second file directory, thereby enabling the second application to access the public file directory, includes: When the second application is detected to have opened the second file directory, a file access request for the second application to access the first file directory is generated, and the file management module is invoked to send the file access request to the first application; When the first application receives the file access request, it calls the file access interface to enable the second application to access the public file directory.

4. The file sharing method according to claim 1, characterized in that, The step of reading metadata information from the first file directory of the first application based on the public file directory and sending the metadata information to the second file directory to achieve file sharing between applications includes: Based on the mutual trust relationship between the first device and the second device and the public file directory, the metadata information is obtained; The metadata information is sent to the second file directory. Based on the metadata information, the files in the first file directory are displayed to the user through the second file directory, thereby realizing file sharing between applications.

5. The file sharing method according to claim 4, characterized in that, Before obtaining the metadata information based on the mutual trust relationship between the first device and the second device and the public file directory, the method further includes: Based on the constraint application protocol, the mutual trust relationship is established between the first device and the second device.

6. The file sharing method according to any one of claims 1-5, characterized in that, After reading the metadata information of the first application's first file directory based on the public file directory and sending the metadata information to the second file directory to achieve file sharing between applications, the method further includes: Based on user actions, update and save the files in the first file directory and the first file directory itself.

7. A file-sharing device, characterized in that, include: The public file directory access module is used to call the file access interface when it is detected that a second application has opened a second file directory, so as to enable the second application to access the public file directory; The file sharing module is used to read the metadata information of the first file directory of the first application based on the public file directory, and send the metadata information to the second file directory to realize file sharing between applications; The file sharing device further includes a directory association module, which includes: An application file directory creation unit is used to create the first file directory for a first application in a first device and to create the second file directory for a second application in a second device; A public file directory creation unit is used to create a mount directory, in which a distributed file system directory is created, and based on the distributed file system directory, the public file directory is created. The directory association unit is used to associate the first file directory with the public file directory.

8. A computer device, characterized in that, The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and, in executing the computer program, implement the file sharing method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to implement the file-sharing method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Shared file operation method and device for Linux compatible Android system

    CN113986858A