Windows equivalent of a MacOS.app with a contents directory - windows

This may sound like I'm just looking for a .exe file, but I'm not all that familiar with windows. I have been using pyinstaller to turn my apps into binaries. My app relies on a lot data directories and third party binaries that I package within the same directory as the executable binary. For Mac, this makes things easy because the user only has to click on MyApp.app inside the applications directory which is like a link to MyApp.app/Contents/MacOs/MyApp. This way MyApp never has to be touched and is all bundled together with the data directories (also loaded inside of MyApp.app/Contents/MacOs/).
However, I can't really find a windows equivalent. While Pyinstaller can create a directory with my data directories and executable inside of it, if the user ever moves the .exe file inside the directory, the app will never work (because it loses its relative location to the data directories). Is there such a thing that can package this directory like on MacOS so the user just has to click on a single .exe file that links to the .exe inside the directory packaged within it? That way we can just pass around one directory. Like a Mac.app?

Win32 apps store data within the executable file as resources, which allows the single file solution, but they can't be accessed using normal file APIs, there are a separate set of functions for resource handling. (This implies that resources aren't so useful for things that absolutely have to be files, like images of helper executables.)
Win32 also has alternate data streams, which are more similar to what you're used to with .app packages, separating a local identifier from the actual filename by $DATA:. But those only work on NTFS, get lost by many file management applications, never have been very popular, and are now effectively deprecated by Microsoft (by preventing access from Windows Store apps).

Related

Allowing a Macintosh application to write files

We market an application that runs on multiple platforms, including Macintosh. On the Macintosh the software gets packaged into a .dmg file, and when installed everything goes into the /Applications hierarchy.
Some of the files in our application's hierarchy are samples that users are supposed to be able to modify in place or copy to different files in the same directory. The problem is the permissions that seem to get applied within the /Applications hierarchy prevent our application from doing such operations.
So I either need to change the install so the directories and files in question within /Applications allow modification, or I need to segregate the sample files to a different location on the disk where they can be modified.
I've tried making sure the permissions on the files allow writing at the time the .dmg file is pulled together, but then when the product is installed the permissions get changed to more restrictive ones that don't allow file modification or copying.
I've been able to modify the packaging so the sample files get installed to a different location, but so far I haven't been able to find a suitable area on the Macintosh disk to put them so modification is allowed. I haven't been able to figure out how to tell the packaging that these sample files should be installed into the installer's home directory.
Anyone have any suggestions? I'm afraid I'm a bit of an Apple novice. The procedure to build the .dmg file employs a Makefile that invokes commands like pkgbuild and productbuild. The productbuild command uses a --distribution qualifier that references a .xml file. There don't seem to be any scripts invoked.

Powerbuilder Icon issue

I'm running into an issue where after building an application with Powerbuilder, some users have no issue with viewing icons within the application while others can't see the icons. Also, the main icon for the application doesn't display on the Windows Task bar. I'm going to play with the icon size but if anyone else has any recommendations, that would be great!
I don't like to re-compile the executable every time there's a small graphic change or a customization that applies to only one library, and I don't like to compile graphics into the executable... it makes the exe file very large. No reason to rebuild the exe unless the library list changes. So I use .pbr files, and just rebuild the pbl with a pbr file.
My graphics.pbr file resides in the same directory as my graphics so I don't have to mess with environment variables or worry about file paths. I created an empty graphics.pbl in the AppCore directory, and a graphics.pbr in the graphics directory. The graphics.pbl is in the application's library list. When I have to add or edit graphics, I simply rebuild the graphics.pbl with the graphics.pbr.
I have multiple customers using the same application, with their own graphics (logos) so I do the same thing there. Here's what my directory structure looks like:
MyApp
MyApp.pbw
AppCore
graphics.pbl
bunch more libraries
AppGraphics
single resource file, graphics.pbr
bunch of icons and graphics
Customer1
Customer1.pbl
Customer1.pbr
a few libraries for customization and container for application object
a few custom graphics
Customer2
etc.
The key is to make sure when you add graphics or images to your application from the AppGraphics directory (or the customer directory), make sure there is no directory path.
This solution has made it easier for me to continue developing the next upgrades and versions by moving the code and renaming some directories without having to edit my code because my directory path has changed.
This is lengthy, but I hope it helps!
~~~Tracy
Within the IDE where you insert the icon file name, make sure you don't have a path (like "C:\graphics\myicon.ico") - only the name of the icon file. Then make sure the icon files are somewhere in a folder within the PATH variable on your system. When you build your application you can use a PBR file (a resource file) in the project for the application. If you list all the graphic files used in the application in this resource file they will be included in the exe (and you won't have to distribute them separately).
Matt is right on point with not using path names in your image references in the app. Also correct that it is best to compile them into the app.
However, during development I like to separate my resources and DLLs into separate directories. To do this without changing global env variables, you can include your directories in the PB "App Paths" registry section.
Depending on your PB Version...
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\pb125.exe"
There you will find a "PATH" value. Just append your dev, resource, dll, directories to that path separated by ";" and PB will find them (requires restart).
I actually create reg files in the root of each app I'm working on to quickly register my paths.
NOTE: The same thing works with your final compiled application; but instead of using the PB section, there will be section created with the name of your executable. Just do the same thing there - add paths where resources are separated from the EXE directory.

Is there a way to merge redundant files when preparing a .dmg file?

My company ships a package containing several Qt-based MacOS/X GUI applications; the package ships as a .dmg file, and "installation" consists of double-clicking the .dmg icon, then dragging one or more application icons to where he wants to keep them (e.g. to his own Applications folder).
This works fine, but the .dmg file is rather large (e.g. 40+MB) and I'd like to reduce its size if possible, in order to reduce the time it takes to download it. One thing I notice is that the applications in the package all have a significant number of large files in common (Qt libraries, graphic resource files, etc), and that currently we are including a separate copy of each of these files inside the blah.app/Contents folder of each included application -- presumably this is what makes the .dmg file so large.
So my question is, is there any way to modify the .dmg so that it doesn't need to include several copies of these files, and thus isn't so big? Ideally I'd like to do this without requiring the user to run a special installer program, and without causing any of the applications to break if the user moves them to different (or unexpected) folders, or deletes any of them.
It seems like this would be an ideal application for hard-links -- i.e. prepare the input to the .dmg file such that one application contains the actual files, and the other applications contain hard-links to those files, so that after the user unpacks the applications from the .dmg file the files remain logically independent of each other (and in particular application B won't stop working if the user moves or deletes application A). But AFAICT MacOS/X doesn't support hard-links [edit: to directories] for applications that aren't named Time Machine. :^(
(it feels vaguely immoral to answer my own question, but since I came to a solution I'll do it anyway, rather than leave the question hanging open)
The solution is to replace the duplicate files with hard-links to the first-encountered file, before running hdiutil to create the .dmg file. I did this using a simple C++ program that I wrote for the purpose (just because I'm stubborn that way), but there are also a number of freeware programs such as freedup that will do this for you. I didn't try them, but I imagine they all work fine.

Is there a counterpart of Mac OS-X filesystem bundles on Windows?

What I need is a directory which the user can handle as a single file in the Windows explorer. Does something like this exist? If not, what comes closest?
The closest thing is probably Alternate Data Streams, although those are more akin to MacOS Named Forks than Bundles.
There are also some special cases, for example if you save a website with Internet Explorer you get an HTML file and a folder which are linked together.
Depends on your particular needs. As mentioned above, named streams are possible (on NTFS), however you should notice that not all applications copy files with named streams correctly. In some scenarios regular ZIP archives can work (Explorer shows them as folders). If you are doing software development, there exist libraries that let you store many files in one container file (eg. SolFS).
I think you can create a folder with an extension, e.g. Myfolder.bundle, then you can associate that extension with a custom icon. So it looks like a bundle as far as the end user is concerned.

cocoa + .app file

i have an executable for my cocoa application as xyz.app file. But when i copy this on windows, it is showing this as a directory with all the resource files and stuff. Is there any way to create a single file executable on mac also (like .exe file on windows) so as to disable the user from seeing the resource files and other files?
Thanks
You talking about a Bundle, which is a folder that is given an extension and the OS treats it as if it is a single file, while in reality it is a folder with resources in it. The NIB files are stored in this bundle as well as your executable and the info.plist file. This is just the way apps work in Cocoa.
The only way around it would be to write your app in a different language, but i'm not sure which, if any, will give you a single file executable.
What are you storing in your app directory that you don't want people to have access to?
There are ridiculously complicated ways to do that, sure. For example, you could gzip all your resource files and decompress them at runtime. But there's no good reason to do so — all it does is make more work for you, introduce additional complexity and make your app slow. Adobe doesn't do this, Microsoft doesn't do this, micro-ISVs don't do this — it's just not advisable.

Resources