You are here

Programming A Portable App's Source

7 posts / 0 new
Last post
lwc
Offline
Last seen: 1 month 3 days ago
Translator
Joined: 2006-04-26 06:35
Programming A Portable App's Source

I know this site is mainly about creating a portableapp version for non portable softwares. But what if you're the programmer him/herself? How would you make your program portable from the get go? Assuming it's a standalone program without registry access or anything.

It's not just the PC world (Mac, Linux, etc.). Keep in mind each mobile device relies on a different programming language too. So how can you reach the widest audience possible? Is Flash maybe the way to go?

Thanks!

digitxp
digitxp's picture
Offline
Last seen: 12 years 6 months ago
Joined: 2007-11-03 18:33
Depends

It depends on what you mean by 'portable'.
If you're going for cross-platfrom, then some ways you can go are Python, C (without any platform-specific stuff), HTML + Javascript (then you're relying on Prism to maintain interoperability), and there's a whole lot more.
If you're going for USB Portable, then anything not using Microsoft's development software will do (just about), as long as you don't call the registry. If it's 100% standalone (as in it's a single EXE and nothing more), then PAFifying it is easy--you just plop it in the top directory in place of the launcher. You can also program it to write into the data folder from there.
If you mean mobile device portable, HTML + Javascript is really the only way to keep everything cross-platform.

Insert original signature here with Greasemonkey Script.

OliverK
OliverK's picture
Offline
Last seen: 2 years 9 months ago
Developer
Joined: 2007-03-27 15:21
give it a commandline switch

give it a commandline switch to tell it where the data should go.

Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world

Darkbee
Darkbee's picture
Offline
Last seen: 3 years 10 months ago
Joined: 2008-04-14 09:41
Also Per-User Settings

In addition to what's been said already, many program's make use of the operating system's notion of users. On Windows you have the "Documents and Settings" folder (depending on your version of Windows) which contains a folder for each user of that particular computer. On Linux you have the "Home" directory, which does likewise.

Typically portable applications must ignore these directories in favor of storing application settings in one or more files that reside with the main executable. The only problem with this is that you then only have settings for all users, not per user. A way to get around this is to store settings in a separate file for each user (a profile if you like), but then you have give the user a mechanism for choosing his or her profile at load time which can be annoying.

One solution to that is to name the settings file based on the current login name, but that isn't without it's problems if you change computers frequently (and ergo change usernames). You could still create copies of a settings file, one for each username you're likely to use.

This could be a complete non-issue, if it doesn't make sense for your application to have per-user settings, sometimes it isn't necessary. However, something to think about.

lwc
Offline
Last seen: 1 month 3 days ago
Translator
Joined: 2006-04-26 06:35
You concentrate on saving settings

You concentrate on how to save settings. But as you can see from the link, Nokia expects Java while Apple expects Apple's own code, etc. So how can a program be made to fit everything?

Jimbo
Offline
Last seen: 4 years 2 months ago
Joined: 2007-12-17 05:43
Not what this site does

I think you may have misunderstood what PortableApps.com is about.

Here, the devs specialise in making Windows applications for full-blown PCs portable, in the sense that they can be carried with you, e.g. on a flash drive, and used on any PC you have access to.

It is not at all about writing applications that can run on multiple platforms. There is no complete solution to that, and nor will there ever be one. Java Mobile Edition is probably the closest you will get, but even there, you'll find quirks and differences in behaviour from one platform to another.

Darkbee
Darkbee's picture
Offline
Last seen: 3 years 10 months ago
Joined: 2008-04-14 09:41
Good Luck

As was stated, if you're talking about cross-platform programming then the closest you're probably going to get is Java. I think there's a Java Virtual Machine for just about every popular platform on the planet (including embedded mobile devices). Although as noted, every platform has it's quirks.

A universal, one size fits all programming language is very impractical because of the underlying hardware (and its inherent capabilities) which differs from device to device.

Depending on how complicated your programs are, then the Web would be another direction, but even here there are devices that don't support Flash, or don't have a browser to be able to make use of HTML/JavaScript, so it's still very hit and miss.

As an addendum to what Jimbo said, it is just coincidence that many of the applications here happen to run on other platforms like Linux and OSX, partly because that is the nature of open source software and development tools used within that movement.

Log in or register to post comments