CN110795394A - File acquisition method and device - Google Patents
File acquisition method and device Download PDFInfo
- Publication number
- CN110795394A CN110795394A CN201911061972.0A CN201911061972A CN110795394A CN 110795394 A CN110795394 A CN 110795394A CN 201911061972 A CN201911061972 A CN 201911061972A CN 110795394 A CN110795394 A CN 110795394A
- Authority
- CN
- China
- Prior art keywords
- path
- target
- file
- relative
- virtual
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/13—File access structures, e.g. distributed indices
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention provides a method and a device for acquiring a file, which are applied to a terminal comprising a path container.
Description
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a file acquisition method and a file acquisition apparatus.
Background
With the development of the processing capability, rendering capability and the like of the terminal, if the terminal configuration is higher, the processing capability, rendering capability and the like of the terminal are stronger, and a corresponding user often has a higher localization requirement. As in games, users may seek clearer, more detailed visual displays, lossless, realistic audio, and so forth.
Because the game application program is unique in the application mall, if the user pursues high-modulus, high-quality audio and expandable play, the expansion package needs to be downloaded additionally, so that the corresponding expansion content is obtained. Currently, the resource loading mode is to directly obtain a file path corresponding to the resource, and read a corresponding resource file from the file path. However, when searching for resources each time, the whole replacement of the file path is required, which easily increases the overhead of the terminal performance, occupies unnecessary memory, and simultaneously, the logic processing of response is required at the logic layer of the application program, which increases the maintenance cost of the application program.
Disclosure of Invention
The embodiment of the invention provides a file acquisition method, which aims to solve the problems of high terminal performance overhead and high application program maintenance cost in the prior art when file resources are loaded.
Correspondingly, the embodiment of the invention also provides a device for acquiring the file, which is used for ensuring the realization and the application of the method.
In order to solve the above problem, an embodiment of the present invention discloses a method for acquiring a file, which is applied to a terminal including a path container, where the path container includes virtual paths corresponding to files, and the method includes:
acquiring a first path of a current file;
when a target virtual path corresponding to the first path exists in the path container, extracting a relative path corresponding to the target virtual path;
and reading the target file corresponding to the relative path.
Optionally, when a target virtual path corresponding to the first path exists in the path container, extracting a relative path corresponding to the target virtual path includes:
acquiring the directory depth of the relative path;
extracting a target directory corresponding to the target depth from the first path;
and when a target virtual path corresponding to the target directory exists in the path container, extracting a relative path corresponding to the target virtual path.
Optionally, the reading the target file corresponding to the relative path includes:
replacing the target directory with the relative path to generate a target path for the target file;
and reading a target file corresponding to the target path.
Optionally, the method further comprises:
acquiring a second path of the target file;
determining a target virtual path corresponding to the target file, and acquiring an original relative path of the target virtual path;
and updating the original relative path into a target relative path corresponding to the second path.
Optionally, the updating the original relative path to a target relative path corresponding to the second path includes:
extracting a characteristic path corresponding to the target file from the second path;
and replacing the original relative path with a target relative path corresponding to the characteristic path.
The embodiment of the invention also discloses a file acquisition device, which is applied to a terminal comprising a path container, wherein the path container comprises virtual paths corresponding to the files, and the device comprises:
the first path acquisition module is used for acquiring a first path of the current file;
a relative path extracting module, configured to extract a relative path corresponding to the target virtual path when the target virtual path corresponding to the first path exists in the path container;
and the target file reading module is used for reading the target file corresponding to the relative path.
Optionally, the relative path extracting module includes:
a directory depth obtaining submodule for obtaining a directory depth of the relative path;
the target directory extraction submodule is used for extracting a target directory corresponding to the target depth from the first path;
and the relative path extraction sub-module is used for extracting a relative path corresponding to the target virtual path when the target virtual path corresponding to the target directory exists in the path container.
Optionally, the target file reading module includes:
a target path generation submodule, configured to replace the target directory with the relative path, and generate a target path for the target file;
and the target file reading submodule is used for reading the target file corresponding to the target path.
Optionally, the method further comprises:
the second path acquisition module is used for acquiring a second path of the target file;
the virtual path determining module is used for determining a target virtual path corresponding to the target file and acquiring an original relative path of the target virtual path;
and the relative path updating module is used for updating the original relative path into a target relative path corresponding to the second path.
Optionally, the relative path updating module includes:
the characteristic path extraction submodule is used for extracting a characteristic path corresponding to the target file from the second path;
and the relative path updating submodule is used for replacing the original relative path with a target relative path corresponding to the characteristic path.
The embodiment of the invention also discloses a device, which comprises:
one or more processors; and
one or more machine readable media having instructions stored thereon that, when executed by the one or more processors, cause the apparatus to perform one or more methods as described above.
Embodiments of the invention also disclose one or more machine-readable media having instructions stored thereon, which when executed by one or more processors, cause the processors to perform one or more of the methods described above.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, the method is applied to the terminal comprising a path container, by acquiring the first path of the current file, when a target virtual path corresponding to the first path exists in the path container, extracting a relative path corresponding to the target virtual path, then reading the target file corresponding to the relative path, and dynamically reading the file through the virtual path stored in the path container in the file acquisition process through the virtual path and the relative path corresponding to the virtual path, so that an application layer does not need to care about the problem of file path replacement, the cost of terminal performance is reduced, excessive logic processing does not need to be performed on a logic layer, and the maintenance cost of the logic layer is reduced.
Drawings
FIG. 1 is a flowchart illustrating a first embodiment of a file retrieval method according to the present invention;
FIG. 2 is a flowchart illustrating steps of a second embodiment of a file retrieval method according to the present invention;
fig. 3 is a block diagram of an embodiment of a file acquiring apparatus according to the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a file obtaining method according to the present invention is shown, and is applied to a terminal including a path container, where the path container includes a virtual path corresponding to each file, and the method specifically includes the following steps:
in an online game or a stand-alone game, a game operator often develops various different game expansion packages, and the game expansion packages can comprise data packages such as game playing expansion, game pictures, game special effects, game audio and the like, so that a user can select and load different game expansion packages according to the requirement of the user or the configuration capacity of a terminal.
For example, when a user wants a game picture with high definition or a gorgeous skill special effect, the corresponding game expansion package can be downloaded, and the terminal reads the corresponding resource file, so that the terminal can display the game picture with high definition or the gorgeous skill special effect for the user.
It should be noted that, in the embodiment of the present invention, a game application is taken as an example for illustration, and it is understood that an extension package may also be a resource extension package other than a game resource extension package, which is not limited in this respect.
In the embodiment of the present invention, the present invention may be applied to a terminal, where the terminal may include a mobile device, and specifically may include a mobile phone, a Personal Digital Assistant (PDA), a laptop computer, a palmtop computer, and the like, and may also include a fixed device, and specifically may include a desktop computer, a vehicle-mounted terminal, an intelligent home, and the like, which is not limited in this embodiment of the present invention.
These terminals may support operating systems such as Windows, Android (Android), IOS, Windows phone, and the like, may also support embedded systems, and may generally run game applications.
In a specific implementation, a path container may be provided in a file system of the terminal, and virtual paths of the extension packets may be stored in the path container. The virtual path may be stored in a key-value pair manner, for example, the key may be a virtual path, and the value may be a relative path corresponding to the virtual path.
For example, the virtual path and the relative path of the development package may be represented in pseudo code:
'hero\1001':'extend\hero_xxx\1001'
'sound':'extend\sound_xxx'
the 'hero \1001' and the 'sound' may be virtual paths, and the 'extended \ hero _ xxx \1001' and the 'extended \ sound _ xxx' may be relative paths, and the relative paths may be dynamically changed along with changes of the extension packets.
Specifically, when the terminal receives a resource switching instruction of the user, the first path of the current file may be obtained first. The current file is a resource file loaded by the current terminal, and may include an audio file, a game screen file, a game special effect file, and the like. When the user wants to load resource files of the same type and different qualities, the terminal may respond to the switching instruction of the user and then acquire the file path of the current file.
In an example of the embodiment of the present invention, when a user wants to switch to a high-quality game audio, the terminal may first obtain a file path of a current audio file, for example, the file path may be sound \ bgm \ music.
in the embodiment of the present invention, after the terminal acquires the first path of the current file, the first path may be adopted, and in the path container, whether a target virtual path that is the same as the file type of the current file and corresponds to the first path exists is searched.
In a specific implementation, when a target virtual path corresponding to the first path exists in the path container, indicating that a target file corresponding to the current file exists, the terminal may further obtain a relative path corresponding to the target virtual path. The relative path may be a file path for acquiring the target file.
And 103, reading the target file corresponding to the relative path.
In a specific implementation, after the terminal obtains the relative path for obtaining the target file, the corresponding target file can be read by using the relative path, and the target file is loaded, so that the file is dynamically read through the virtual path stored in the path container and the relative path corresponding to the virtual path in the file obtaining process, an application layer does not need to care about the problem of file path replacement, the cost of terminal performance is reduced, excessive logic processing is not needed to be performed on a logic layer, and the maintenance cost of the logic layer is reduced.
When the path container does not have the target virtual path corresponding to the first path, the terminal may replace the first path with a file path of the target file in a file path replacement manner, and read the corresponding resource file.
In an example of the embodiment of the present invention, a current file in a game application program is a default audio file, and when a user wants to set and use a medium-quality audio file, a terminal may respond to a setting instruction of the user to obtain a file path of the current audio file, which is sound \ bgm \ music. Then, the terminal may search whether a target virtual path corresponding to the file path exists from the path container, and when the target virtual path corresponding to the file path exists, such as 'sound', a relative path corresponding to the target virtual path may be extracted as 'extended \ sound _ middle', and then the relative path may be adopted to read and load an audio file of medium quality, so that the file may be dynamically read through the virtual path and the relative path corresponding to the virtual path, so that the application layer does not need to care about the problem of file path replacement, the overhead of terminal performance is reduced, excessive logic processing does not need to be performed on the logic layer, and the maintenance cost of the logic layer is reduced.
In the embodiment of the invention, the method is applied to the terminal comprising a path container, by acquiring the first path of the current file, when a target virtual path corresponding to the first path exists in the path container, extracting a relative path corresponding to the target virtual path, then reading the target file corresponding to the relative path, and dynamically reading the file through the virtual path stored in the path container in the file acquisition process through the virtual path and the relative path corresponding to the virtual path, so that an application layer does not need to care about the problem of file path replacement, the cost of terminal performance is reduced, excessive logic processing does not need to be performed on a logic layer, and the maintenance cost of the logic layer is reduced.
Referring to fig. 2, a flowchart illustrating steps of an embodiment of a file obtaining method according to the present invention is shown, and is applied to a terminal including a path container, where the path container includes a virtual path corresponding to each file, and the method specifically includes the following steps:
in the embodiment of the invention, when a user wants to set the terminal to use different extension files, the terminal can respond to a setting instruction of the user, and acquire the first path of the current file and the second path of the target file.
In a specific implementation, when the terminal receives a resource switching instruction of a user, a first path of a current file may be obtained first. The current file is a resource file loaded by the current terminal, and may include an audio file, a game screen file, a game special effect file, and the like. The target file may be a file of the same file type as the current file, for example, when the current file is an audio file, the target file is an audio file.
in the embodiment of the present invention, the path container stores the virtual path corresponding to each expansion package. The same type of expansion package can comprise multiple data packages with different qualities, the expansion packages with different qualities can correspond to the unique file path, for example, the audio expansion package can comprise data packages with default quality audio, medium quality audio, high quality audio and the like, the game picture expansion package can comprise data packages with smooth quality, high definition quality, ultra-definition quality, 4k quality and the like, and each data package corresponds to the unique file path.
For example, the file path for high quality audio: sound _ high \ bgm \ music.bnk, file path of medium quality audio: sound _ middle \ bgm \ music.
In specific implementation, files of the same type in the path container correspond to the same virtual path, the same virtual path may correspond to different relative paths, and the relative paths may dynamically change along with the file path of the target file. The terminal may first search for a target virtual path corresponding to the target file from the path container after acquiring the second path of the target file, and may acquire an original relative path corresponding to the target virtual path after the target virtual path corresponding to the target file exists, so as to dynamically update the original relative path according to the second path.
in a specific implementation, the terminal may extract a characteristic path corresponding to the target file from the second path, and then replace the original relative path with a target relative path corresponding to the characteristic path.
Specifically, the file paths of the same type of file may be distinguished according to different quality features, for example, for an audio file, the audio file may include default audio, medium-quality audio, high-quality audio, and the like, and the corresponding file paths are respectively:
file path for high quality audio: sound _ high \ bgm \ music
File path for medium quality audio: sound _ middle \ bgm \ music
File path for default quality audio: sound \ bgm \ music
The feature path may be "sound _ high", "sound _ middle", and "sound", among others. After the terminal obtains the second path of the target file, the characteristic path can be extracted from the second path, and then the relative path in the virtual path is updated. For example, the virtual path and relative path corresponding to an audio file are: ' sound ': extended \ sound _ xxx ', according to the characteristic path ' sound _ middle ' in the second path, the ' sound _ xxx ' can be updated to ' sound _ middle ', so that the relative path is updated to the file path corresponding to the target file.
in a specific implementation, when a target virtual path corresponding to the first path exists in the path container, indicating that a target file corresponding to the current file exists, the terminal may further obtain a relative path corresponding to the target virtual path. The relative path may be a file path for acquiring the target file.
In an alternative embodiment of the present invention, a virtual path may be searched from the path container according to the depth of the file directory, and step 204 may include the following sub-steps:
substep S11, obtaining a directory depth of the relative path;
in a specific implementation, the directory depth of the relative path may be set according to a file directory of the resource file. The file directory of the resource file can be composed of multiple levels of directories, and multiple levels of sub-directories can be included under the parent directory, so that the directory depth of the relative path can be determined according to the characteristic path in the file path of the resource file as a node, wherein the parent directory comprises the characteristic path and the characteristic path at each level.
In an example of the embodiment of the present invention, a file path of an audio file is taken as an example for description, when the file path of the audio file is sound \ bgm \ music.bnk, and a corresponding characteristic path is "sound", which includes a primary directory, then the directory depth is 1, and a relationship between a virtual path and a relative path in a path container may be ' sound ': extended \ sound _ xxx '; when the file path of the audio file is sound \ sound _ changjing \ bgm \ music.bnk, and the corresponding characteristic path is sound \ sound _ changjing ", which represents the scene audio in the audio, that is, the user can select the quality of the scene audio, the directory depth is 2, and the relationship between the virtual path and the relative path in the path container can be ' sound ': extended \ sound \ sound _ changjing _ xxx ', etc., so that the directory depth of the relative path can be dynamically adjusted according to the path depth of the resource file, thereby improving the applicability of file matching and ensuring the uniqueness of file reading.
It should be noted that, the embodiment of the present invention includes but is not limited to the above examples, and it is understood that, under the guidance of the idea of the embodiment of the present invention, a person skilled in the art may set a file path of a relative path according to an actual situation, and the present invention is not limited to this.
Specifically, in the process of searching for the file, the terminal may first obtain the directory depth of the target relative path from the path container, so as to determine whether the target virtual path corresponding to the first path exists in the path container according to the directory depth.
A substep S12 of extracting a target directory corresponding to the target depth from the first path;
in a specific implementation, after the directory depth of the relative path is obtained, a target directory corresponding to the target depth may be extracted from the first path.
In an example of the embodiment of the present invention, the current file is an audio file, the first path is sound \ bgm \ music.
In another example of the embodiment of the present invention, the current file is an audio file, the first path is sound \ sound _ changjing \ bgm \ music.
And a substep S13, when a target virtual path corresponding to the target directory exists in the path container, extracting a relative path corresponding to the target virtual path.
In a specific implementation, after the target directory corresponding to the first path is determined, the target directory may be used to search whether a corresponding target virtual path exists from the path container, and when a target virtual path corresponding to the target directory exists, the terminal may further obtain a target relative path corresponding to the target virtual path.
In a specific implementation, after the terminal obtains the target relative path for obtaining the target file, the terminal may adopt the target relative path, read the corresponding target file, and load the target file.
In an alternative embodiment of the present invention, step 205 may comprise the following sub-steps:
a substep S21 of replacing the target directory with the relative path and generating a target path for the target file;
and a substep S22 of reading a target file corresponding to the target path.
In a specific implementation, after the terminal obtains the target relative path, the target relative path and the first path may be adopted to generate a target path for acquiring the target file. Specifically, the target directory in the first path may be replaced by a target relative path, so as to obtain a real file path of the target file, and then the target file is read from the target path, so that the file is dynamically read through the virtual path and the relative path corresponding to the virtual path in the file acquisition process through the virtual path stored in the path container, so that the application layer does not need to care about the problem of file path replacement, the cost of terminal performance is reduced, excessive logic processing does not need to be performed on the logic layer, and the maintenance cost of the logic layer is reduced.
In an example of the embodiment of the present invention, a current file in a game application program is a default audio file, and when a user wants to set and use a medium-quality audio file, a terminal may respond to a setting instruction of the user to obtain a file path of the current audio file, which is sound \ bgm \ music. Meanwhile, the file path of the audio file with medium quality is determined as sound _ middle \ bgm \ music.
Then, in the path container, finding a virtual path corresponding to the audio file: 'found': extended \ found _ xxx ', updates the virtual path to' found ': extended \ found _ middle' according to the characteristic path, and the directory depth is 1.
The terminal can extract a target directory from the first path according to the target depth to be "sound", and adopt the target directory to search whether a target virtual path corresponding to the file path exists in the path container, when the target virtual path 'sound' is searched, a target relative path corresponding to the target virtual path can be extracted to be 'extended \ sound _ middle', then the target relative path can be adopted to replace the 'sound' in the first path to obtain a target path of a medium-quality audio file which is extended \ sound _ middle \ bgm \ music.bnk, and then the medium-quality audio file is read from the target path and loaded, so that the file is dynamically read through the virtual path and the relative path corresponding to the virtual path, the problem of file path replacement is not needed by an application layer, the performance of the terminal is reduced, and excessive logic processing is not needed by the logic layer, the maintenance cost of the logic layer is reduced.
In addition, when the user wants to set a high-quality audio file, the terminal may update the virtual path in the path container, for example, may update 'sound' extended \ sound _ middle 'to' sound 'extended \ sound _ high', thereby implementing dynamic path management and improving convenience of file management.
It should be noted that, the embodiment of the present invention includes but is not limited to the foregoing examples, and it is understood that, under the guidance of the idea of the embodiment of the present invention, a person skilled in the art may set the type of the file, the type of the application program, the terminal, and the like according to the actual situation, and the present invention is not limited to this.
In the embodiment of the invention, the method is applied to the terminal comprising a path container, by acquiring the first path of the current file, when a target virtual path corresponding to the first path exists in the path container, extracting a relative path corresponding to the target virtual path, then reading the target file corresponding to the relative path, and dynamically reading the file through the virtual path stored in the path container in the file acquisition process through the virtual path and the relative path corresponding to the virtual path, so that an application layer does not need to care about the problem of file path replacement, the cost of terminal performance is reduced, excessive logic processing does not need to be performed on a logic layer, and the maintenance cost of the logic layer is reduced.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 3, a block diagram of a file obtaining apparatus according to an embodiment of the present invention is shown, and is applied to a terminal including a path container, where the path container includes a virtual path corresponding to each file, and specifically includes the following modules:
a first path obtaining module 301, configured to obtain a first path of a current file;
a relative path extracting module 302, configured to, when a target virtual path corresponding to the first path exists in the path container, extract a relative path corresponding to the target virtual path;
and an object file reading module 303, configured to read an object file corresponding to the relative path.
In an optional embodiment of the present invention, the relative path extracting module 302 includes:
a directory depth obtaining submodule for obtaining a directory depth of the relative path;
the target directory extraction submodule is used for extracting a target directory corresponding to the target depth from the first path;
and the relative path extraction sub-module is used for extracting a relative path corresponding to the target virtual path when the target virtual path corresponding to the target directory exists in the path container.
In an optional embodiment of the present invention, the target file reading module 303 includes:
a target path generation submodule, configured to replace the target directory with the relative path, and generate a target path for the target file;
and the target file reading submodule is used for reading the target file corresponding to the target path.
In an optional embodiment of the present invention, the method further includes:
the second path acquisition module is used for acquiring a second path of the target file;
the virtual path determining module is used for determining a target virtual path corresponding to the target file and acquiring an original relative path of the target virtual path;
and the relative path updating module is used for updating the original relative path into a target relative path corresponding to the second path.
In an optional embodiment of the present invention, the relative path updating module includes:
the characteristic path extraction submodule is used for extracting a characteristic path corresponding to the target file from the second path;
and the relative path updating submodule is used for replacing the original relative path with a target relative path corresponding to the characteristic path.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
An embodiment of the present invention further provides an apparatus, including:
one or more processors; and
one or more machine-readable media having instructions stored thereon, which when executed by the one or more processors, cause the apparatus to perform methods as described in embodiments of the invention.
Embodiments of the invention also provide one or more machine-readable media having instructions stored thereon, which when executed by one or more processors, cause the processors to perform the methods described in embodiments of the invention.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The above method and device for acquiring a file provided by the present invention are described in detail, and a specific example is applied in the text to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (12)
1. A method for acquiring files is applied to a terminal comprising a path container, wherein the path container comprises virtual paths corresponding to the files, and the method comprises the following steps:
acquiring a first path of a current file;
when a target virtual path corresponding to the first path exists in the path container, extracting a relative path corresponding to the target virtual path;
and reading the target file corresponding to the relative path.
2. The method according to claim 1, wherein when a target virtual path corresponding to the first path exists in the path container, extracting a relative path corresponding to the target virtual path comprises:
acquiring the directory depth of the relative path;
extracting a target directory corresponding to the target depth from the first path;
and when a target virtual path corresponding to the target directory exists in the path container, extracting a relative path corresponding to the target virtual path.
3. The method of claim 2, wherein reading the target file corresponding to the relative path comprises:
replacing the target directory with the relative path to generate a target path for the target file;
and reading a target file corresponding to the target path.
4. The method of claim 1, further comprising:
acquiring a second path of the target file;
determining a target virtual path corresponding to the target file, and acquiring an original relative path of the target virtual path;
and updating the original relative path into a target relative path corresponding to the second path.
5. The method of claim 4, wherein the updating the original relative path to the target relative path corresponding to the second path comprises:
extracting a characteristic path corresponding to the target file from the second path;
and replacing the original relative path with a target relative path corresponding to the characteristic path.
6. An apparatus for acquiring a file, which is applied to a terminal including a path container, where the path container includes a virtual path corresponding to each file, the apparatus comprising:
the first path acquisition module is used for acquiring a first path of the current file;
a relative path extracting module, configured to extract a relative path corresponding to the target virtual path when the target virtual path corresponding to the first path exists in the path container;
and the target file reading module is used for reading the target file corresponding to the relative path.
7. The apparatus of claim 6, wherein the relative path extraction module comprises:
a directory depth obtaining submodule for obtaining a directory depth of the relative path;
the target directory extraction submodule is used for extracting a target directory corresponding to the target depth from the first path;
and the relative path extraction sub-module is used for extracting a relative path corresponding to the target virtual path when the target virtual path corresponding to the target directory exists in the path container.
8. The apparatus of claim 7, wherein the target file reading module comprises:
a target path generation submodule, configured to replace the target directory with the relative path, and generate a target path for the target file;
and the target file reading submodule is used for reading the target file corresponding to the target path.
9. The apparatus of claim 6, further comprising:
the second path acquisition module is used for acquiring a second path of the target file;
the virtual path determining module is used for determining a target virtual path corresponding to the target file and acquiring an original relative path of the target virtual path;
and the relative path updating module is used for updating the original relative path into a target relative path corresponding to the second path.
10. The apparatus of claim 9, wherein the relative path update module comprises:
the characteristic path extraction submodule is used for extracting a characteristic path corresponding to the target file from the second path;
and the relative path updating submodule is used for replacing the original relative path with a target relative path corresponding to the characteristic path.
11. An apparatus, comprising:
one or more processors; and
one or more machine-readable media having instructions stored thereon that, when executed by the one or more processors, cause the apparatus to perform the method of one or more of claims 1-5.
12. One or more machine readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method of one or more of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911061972.0A CN110795394B (en) | 2019-11-01 | 2019-11-01 | File acquisition method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911061972.0A CN110795394B (en) | 2019-11-01 | 2019-11-01 | File acquisition method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110795394A true CN110795394A (en) | 2020-02-14 |
CN110795394B CN110795394B (en) | 2022-09-30 |
Family
ID=69440757
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911061972.0A Active CN110795394B (en) | 2019-11-01 | 2019-11-01 | File acquisition method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110795394B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113332730A (en) * | 2020-02-18 | 2021-09-03 | 腾讯科技(深圳)有限公司 | Game resource loading method and device, storage medium and electronic device |
CN114979119A (en) * | 2022-05-23 | 2022-08-30 | 深圳市云语科技有限公司 | Method for supporting multiple storages through virtual path in file transmission system |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1949213A (en) * | 2005-10-12 | 2007-04-18 | 富士施乐株式会社 | File server, file providing method and recording medium |
US7877413B1 (en) * | 2002-06-12 | 2011-01-25 | Symantec Corporation | Path variablizing layered system |
CN105580010A (en) * | 2014-09-01 | 2016-05-11 | 华为技术有限公司 | File access method and apparatus, and storage system |
CN105989007A (en) * | 2015-01-27 | 2016-10-05 | 珠海金山办公软件有限公司 | File path processing method and device |
CN107491334A (en) * | 2017-08-29 | 2017-12-19 | 四川长虹电器股份有限公司 | A kind of tissue and loading method for preloading file |
-
2019
- 2019-11-01 CN CN201911061972.0A patent/CN110795394B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7877413B1 (en) * | 2002-06-12 | 2011-01-25 | Symantec Corporation | Path variablizing layered system |
CN1949213A (en) * | 2005-10-12 | 2007-04-18 | 富士施乐株式会社 | File server, file providing method and recording medium |
CN105580010A (en) * | 2014-09-01 | 2016-05-11 | 华为技术有限公司 | File access method and apparatus, and storage system |
CN105989007A (en) * | 2015-01-27 | 2016-10-05 | 珠海金山办公软件有限公司 | File path processing method and device |
CN107491334A (en) * | 2017-08-29 | 2017-12-19 | 四川长虹电器股份有限公司 | A kind of tissue and loading method for preloading file |
Non-Patent Citations (1)
Title |
---|
不过是混吃等死: "绝对路径、相对路径、虚拟路径以及资源路径", 《HTTPS://BLOG.CSDN.NET/WEIXIN_42387411/ARTICLE/DETAILS/100584642》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113332730A (en) * | 2020-02-18 | 2021-09-03 | 腾讯科技(深圳)有限公司 | Game resource loading method and device, storage medium and electronic device |
CN114979119A (en) * | 2022-05-23 | 2022-08-30 | 深圳市云语科技有限公司 | Method for supporting multiple storages through virtual path in file transmission system |
Also Published As
Publication number | Publication date |
---|---|
CN110795394B (en) | 2022-09-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR100597670B1 (en) | mobile communication terminal capable of reproducing and updating multimedia content, and method for reproducing the same | |
EP3525410A1 (en) | Account login method, apparatus, and server | |
CN110795394B (en) | File acquisition method and device | |
CN109246230B (en) | Information pushing method and device | |
CN105740057A (en) | Information processing method and device | |
CN112241397B (en) | Sharing method and device of multimedia files, electronic equipment and readable storage medium | |
CN111241040B (en) | Information acquisition method and device, electronic equipment and computer storage medium | |
CN109343793B (en) | Data migration method and device | |
WO2015048195A1 (en) | Dynamically picking content from social shares to display in a user interface | |
CN104268229A (en) | Resource obtaining method and device based on multi-process browser | |
CN106470353B (en) | Multimedia data processing method and device and electronic equipment | |
CN111694585A (en) | Method, system, terminal and storage medium for replacing system partition file | |
CN101770371A (en) | Application theme content preview method and device | |
CN111161283B (en) | Picture resource processing method and device and electronic equipment | |
CN110652728B (en) | Game resource management method and device, electronic equipment and storage medium | |
WO2014002030A2 (en) | Dynamically customizing a digital publication | |
CN109213468B (en) | Voice playing method and device | |
CN108874495B (en) | Theme resource conversion method and device and electronic equipment | |
CN108062952B (en) | Voice control method, device and system | |
CN111722865A (en) | Resource data processing method and device for application program | |
CN104753986A (en) | Terminal, server and e-book synchronization method | |
CN104270676A (en) | Information processing method and electronic equipment | |
CN106488299B (en) | Video file display method and system | |
KR101684577B1 (en) | Method of providing tag-based list of content and apparatus for the same | |
CN106572140B (en) | Media file playing method and terminal equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |