![]() And it turns out the function does the job as well. This time, as we're under /tmp/test/jarTest, we pass directly to the function. $ xJarTo /tmp/another_new_dirĮxtracting /tmp/test/jarTest/ to /tmp/another_new_dir. Next, let's test the relative JAR path scenario: $ pwd Of course, we'll first access the file from a disk: public. It is suggested that Windows 7 users unzip the file by renaming it to omni.zip and using Windows Explorer to extract all files. For example, we'll zip a file named test1.txt into an archive named compressed.zip. First, let's look at a simple operation, zipping a single file. Further, we're still under /tmp/test after calling the function. These core libraries are part of the package, where we can find all zipping- and unzipping-related utilities. The new directory is created on the fly, and the extracted content is under /tmp/a_new_dir. Īs the output above shows, the function works as expected. $ xJarTo /tmp/test/jarTest/ /tmp/a_new_dirĮxtracting /tmp/test/jarTest/ to /tmp/a_new_dir. Testing the Functionįirst, let's test the scenario that the target directory is new and the JAR file is an absolute path: $ pwd Then, we enter the target directory using cd and execute the jar xf command with the prepared JAR file path.įinally, we navigate back to the user's current working directory. The -p option tells the mkdir command to create missing directories in the given path if there are any. ziputils contains some tools for the unzip unit. unzip a unit which implements an unzip mechanism with native Pascal links. There are 4 units: zip a unit which implements an zip mechanism with native Pascal links. Next, we execute the mkdir -p command before entering the target directory. The unzip and zip package contains several routines to unzip or zip files on every Lazarus supported platforms. Therefore, the function adapts both absolute and relative JAR paths. We need to prepend the user's current working directory to build the absolute path to work with if it starts with “ /” – absolute path, so we just use the user input directly.The function first stores the user's current working directory ( pwd) in the the_pwd variable. Another method is to use a GUI-based extractor, which. Let's first have a look at the function, and then understand how it works: #!/bin/bashĮcho "Extracting $the_jar to $the_dir. To extract them, you can use the free command-line-based Java Archive Tool in the Java Development Kit. We can create a shell function to automatically create the directory and adapt the JAR file's path.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |