Is there any software/script that will allow me to cd (change directories) into .jar/.ear/.zip files and edit the contents of the files it contains? I'm working on a large EJB project (yuck), and I frequently find myself in situations like the following:
something.ear/
|-- something.jar/
| `-- fileINeedToEdit.xml
I work primarily via the command line (Mac/Linux), so I find myself decompressing the files with jar -xvf, editing the file I need to edit, and then recompressing with jar -cvf. Obviously, this becomes a major headache after the first few times.
I'd like to be able to treat the compressed files as directories, and simply cd (or some alternate command) to the file I want to edit.
Does anyone know how I can accomplish this?
I agree with the comments to your question, an automated build should allow you to make this kind of changes easily and is the right way to go. But if you insist in this direction, check fuse-zip, it provides the ability for zip files to be mounted on any directory mount point.
There are two general strategies. Either use software that can mount the jars as pseudo file systems. That allows you to work exactly like you are used to, but I'm uncertain how well Mac OS supports user-space filesystems. Or use a tool that already has in-place editing support, like the Windows explorer or a more powerful editor (e.g. emacs).
I use one of this application If I want to check something in jar or ear file
Krusader (file manager from KDE) - it allows to investigate jar, ear or war file, but unfortunatelly doesn't work well with nested jars files
mc (Midnight Commander) - it works pretty well with ear, jar or war, event with nested jars
Related
With more and more programs installed on my computer, I am tired of seeing lots of dotfiles while I have to access them often. For some reason I won't hide dotfiles when browsing files. Is there a way to move them to a better place I want them to stay (e.g. ~/.config/$PROGCONF) without affecting programs while running?
Symlinks still leave file symbols, which is far from my expectation. I expect that operations like listdirs() won't show the files while opening them uses a redirection.
"For some reason it won't hide dotfiles when browsing files.":
That depends on the file manager you use. nautilus hides it by default and most file managers have an option to "show/hide hidden files". The ls command by default omits out hidden files (files starting with a dot). It lists all files with the option -a.
"Is there a way to move them to a better place":
Programs which have support for "XDG user directories" can store their config files in `~/.config/$PROGRAM_NAME/. If the program doesn't support that and expects the config file to be present in the home directory, there is little you can do (Maybe you can give us a list of what programs' config files you want to move). The process differs for each program.
Let me give an example with vim. Its config file is ~/.vimrc. Lets say you move the file to ~/.config/vim/.vimrc. You can make vim read the file by launching vim using the following command.
vim -u ~/.config/vim/.vimrc
You can modify the .desktop entry or create a new shell script to launch vim using the above command and put it inside /usr/local/bin/ or create shell functions / aliases. You can read more about changing vim's config file location in this SO question.
This arch wiki article has application specific information.
"without affecting programs while running":
It depends on a few factors namely the file system used, the program we are dealing with and so on.
Generally, deleting / moving files only unlinks the file name from an inode and programs read / write files using inodes. Read more here. And most programs read the config file at the start, load the values into memory. They rarely read the config files again. So, if you move your config file while the program is running (assuming the program supports config in both places), you won't see a difference until the program is restarted.
"I expect that operations like listdirs() won't show the files"
I am assuming you are talking about os.listdir() in python. If files are present, os.listdir() will list them, there is little you can change about that. But you can write custom functions to omit out the hidden files from being listed.
This SO question can help with that.
We are doing some embedded Linux project, the vendor provides us a basic filesystem skeleton, and we would like to put it into the version control system (GIT), but there are some special files which GIT does not like, for example, the device file, the pipe files, etc. I wounder if anyone have a better suggestion to put a filesystem under version control? Thanks!
Two choices;
1) either put the script which creates the nodes in /dev and the like under version control, and have your build system execute that script.
or
2) Make a dd of the basic file system to a plain file, and put that dd resulting file under version conntrol
There are some script for keeping dev files with git, eg: EtcKeeper http://kitenet.net/~joey/code/etckeeper/
I'm trying to get my website to talk to a friend's program. Think ITunes - one main program with hundreds of thousands of little things installed into it. We don't want to have to create an InstallShield install program for each of those hundreds of thousands of little things.
We have the files grouped into the folder sub-structure.
We have a .REG file for what registry entry needs to be added to see the new folder group.
But is there a way to do a self extracting zip file that reads a registry entry so we know where they installed the original program to be able to dump the new files there as well? I want them to double-click the EXE and click Finish and for everything to work.
(I've been looking into INF and CAB files through IExpress.exe, but haven't found the answer. I remember Package for the Web didn't have an option to read a registry entry, but did let you modify the suggested install path.)
Thanks so much.
Best wishes,
Andrea
But is there a way to do a self extracting zip file that reads a registry entry so we know where they installed the original program to be able to dump the new files there as well? I want them to double-click the EXE and click Finish and for everything to work
Well, yes and no. There are self-extractors that can run a program after extracting all files. DotNetZip, for example, can produce an SFX which can do this.
Just an aside: a normal SFX is just a zip file, with a "stub" executable merged with it. The stub exe can do anything it wants to do, but the most basic thing it does is extract the files in the zip. When you use DotNetZip to produce an SFX, it embeds its particular stub into the zip. That stub knows how to extract files, and also knows how to invoke a program after extracting. You can also produce your own stub that can do other more exotic things.
So you could use an SFX for your purpose. When run, it would extract, then invoke it's extra program. The program could look in the registry, then move or relocate the extracted files to the appropriate place. Then terminate.
For a different twist, the SFX might have just two files: the program-to-run (the one that reads the registry, and another embedded zip. Then when the SFX runs it generates 2 files. Then it invokes the program-to-run, which reads the registry, then unpacks the contained zip and puts the files into the desired place.
Ok, so you could do it.
Should you?
mmm, maybe. This really is an installer, so, you should decide whether you want to use a zip as an installer. Don't forget, if you use an SFX as an installer, there's no good way to uninstall.
Have you tried Inno Setup toolchain? It's a bit better than a bare Self-Extracting ZIP file, it's a setup creation utility. I'm convinced it has got something to put some entry in the Registry, look also at the plugins.
Basically, a self-extracting executable that alters the registry, it's a setup program. So why don't you go for a proper one?
Website: http://www.jrsoftware.org/isinfo.php
I installed the multilib version of mingw-w64 so I could build both 32-bit and 64-bit binaries. Here's a tree representation of the files: http://pastebin.com/r4QUnbwJ. If you only want to view the directories, see this instead: http://pastebin.com/2m6uqt4E. It looks like there are duplicate files in some cases, like in the bin directory. Are they different in any way? Also, I see one directory named "mingw" and another named "x86_64-w64-mingw32". They look about the same in content. Again, what is the difference?
Basically, I just want an explanation of the file layout. I'm not expecting a description of each file, but it would be good if some of the main concepts within mingw-w64 (multilib) were addressed.
In my experience, the /mingw directory can safely be deleted. It is only needed for the strange GCC build system (and can even be empty in some cases).
The x86_64-w64-mingw32/bin directory contains executables called by gcc/g++/gfortran/etc. internally. Don't delete them.
There doesn't seem to be a "standard" directory structure, sometimes the x86_64-w64-mingw32/lib(32) and x86_64-w64-mingw32/include directories contain the same files. Sometimes the same files are even in the root include and lib(32) directories. If you need an expert's answer, feel free to post to the minwgw-64 mailing list, a lot of knowledgeable people reside there.
Are there any good tools for comparing two folder structures (files included) between two environments?
i.e. comparing a dev computer with production
Edit:
A note on some lessons learned: dir /s /o:N >> output.txt works well in conjunction with a text comparison tool (I used WinMerge), but the filesystem does appear to matter. NTFS against FAT32 doesn't work well, as one scans the folders in reverse alphabetical order, and the other doesn't. To solve this issue, I copied the files from the FAT32 to an NTFS drive.
Also, DiffMerge is nice, but slow. It actually hung when run on the server (that's where I had access to both sets of files) to a point that I had to force a quit.
I'm sure others have thoughts on doing this with *NIX. Probably a similar technique like ls -alR > output
It's still pretty manual, but it works well.
Just keep in mind that the times on the folders will more than likely be different, so you may want to use a regex to replace them and make them more consistent, since that's fairly benign (I used [\d]{2}/[\d]{2}/[\d]{4}[\s]*[\d]{2}\:[\d]{2}\sAM[\s]*\<DIR\> and [\d]{2}/[\d]{2}/[\d]{4}[\s]*[\d]{2}\:[\d]{2}\sPM[\s]*\<DIR\>).
I use Diff merge (http://www.sourcegear.com/diffmerge/ - it has a free version) for comparing folder structures on Windows
For a tool that runs on Windows (but can work against Linux samba shares), try BeyondCompare.
One windows.
Use your favorite diff tool on the files generated from this cmd.
Run this from the folders you wish to compare.
c:\somefolder>dir /s > searchResult.txt
WinMerge also does folder and file comparison and its FREEE
Option 1)
Mount one of the machines on the other, then use some standard directory compare utility.
Option 2)
Use rsync --dry-run and use the output in some way.
Option 3)
Generate hashes (e.g. sha256) of the files on each side, then compare the lists.
WinDiff and KDiff both seem good at doing this without the need for command line dir listing. My personal preference is KDiff.
WinDiff shows an expanded list of all files/folders. (I was only interested in differences so turned off "Show Identical Files" in the Options menu).
KDiff presents an expandable tree view with nice colour coding.