I want to create a text file and open it in a text editor with a single command.

I know touch file.txt creates a file and open file.txt opens the file, but is there a way to do this with a single command?


Question: How to delete application data on install and reinstall
Answer: In the 5.0 APIs there is a new class called CodeModuleListener which you could use to monitor when your modules are being uninstalled.  Prior to 5.0 though, there are no hooks.  However, here are a few ideas to think about and/or try:


Use the CodeModuleManager methods getModuleDownloadTimestamp() or getModuleTimestamp() (not sure which one would give the proper information) to look up the "install time" of the module, then store it in persistence.  Then each time the app is started, read the value from the module again and compare it to the persisted value.  If the module value is newer, then the app was reinstalled.
If you store a non-native class in the Persistent Store (i.e. a subclass of Hashtable), it will be removed from the persistent store when you uninstall the app (since without the app, the class is meaningless).  So all you need to do is create a subclass of Hashtable and store that in your persistent store (with your actual data as keys), and it will be automatically removed from the store when the user uninstalls the app.