Here is the script which works for Linux...

---------------------------------BEGIN---
initInstall("Mozilla Calendar", "/Mozilla/Calendar", "0.7");

calendarDir = getFolder("Chrome","calendar");

setPackageFolder(calendarDir);

var err = addDirectory("", "resources", getFolder("Chrome","calendar"), 
"" );

addDirectory("", "components", getFolder( "Components" ), "" );

if ( err == SUCCESS ) {
   var calendarContent = getFolder(calendarDir, "content");
   var calendarSkin    = getFolder(calendarDir, "skin");
   var calendarLocale  = getFolder(calendarDir, "locale");

   var returnval = registerChrome(CONTENT | DELAYED_CHROME, 
calendarContent );
   var returnval = registerChrome(SKIN | DELAYED_CHROME, calendarSkin, 
"modern/");
   var returnval = registerChrome(LOCALE | DELAYED_CHROME, 
calendarLocale, "en-US/");

   err = performInstall();
   if ( err == SUCCESS ) {
     alert("The Mozilla Calendar has been succesfully installed. \n"
       +"Please restart your browser to continue.");
   }
   else {
     alert("performInstall() failed. \n"
     +"_____________________________\nError code:" + err);
     cancelInstall(err);
   }
}
else {
   alert("Failed to create directory. \n"
     +"You probably don't have appropriate permissions \n"
     +"(write access to mozilla/chrome directory). \n"
     +"_____________________________\nError code:" + err);
     cancelInstall(err);
}
--------------------END---------------------

Daniel Veditz wrote:

> Mike Potter wrote:
> 
> 
>>I have a bunch of questions about how I go about creating an XPInstall 
>>for the calendar.
>>First of all, I've got it working under Linux.  That was OK, a 
>>relatively painless experience but I got through it.  Now I need to make 
>>it work under Windows as well.
>>
> 
> 
> The idea behind XPInstall is that the same script should work for all
> platforms unless you're doing platform-specific things. Post your working
> Linux script and we'll tweak it into shape for the other platforms.
> 
> 
>>Here's what I've got:
>>
>>the .xpi file contains the install.js file and the zip of two directories:
>>components/  and
>>resources/ which has:
>>      content/
>>      skin/
>>      locale/
>>
> 
> 
> Should work fine.
> 
> 
>>Components/ has two files which I need to put in the components/ 
>>directory of the Mozilla build.
>>
>>Now I've got some windows dll files that go in the root of the Mozilla 
>>install ( windows equivalent of /usr/local/mozilla ), and some other 
>>dlls that go in components.
>>
> 
> 
> So the structure of the windows version is different? That is, on Linux
> they're all in components but on windows some need to be up a level? Might
> be worth fixing, but doesn't really matter to the install.
> 

Yes, the structure of the windows version is different.  It installs dll 
files that aren't on Linux (obviously) and puts them in the Program 
directory.  There are some similar components that go into the 
Components directory.


> Create a third directory ("bin" or something) and install those libraries to
> the getFolder() target "Program". If you structure the others as
> subdirectories of "bin" then you can install everything with one
> addDirectory() call.
> 
> 
>>I need to know a few things:
>>1. What does Install.platform return for the different platforms?
>>
> 
> 
> Why do you need to know? There are a very few cases where checking
> Install.platform is appropriate; in most cases it's a hack that can be
> handled a better way.
> 
> In any case, the value is supposed to match the relevant fields of the
> default user agent comment. If the default user agent is
> 
>    Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.7+) ...
> 
> then the platform value will be
>    Windows; Windows NT 5.0
> 
> 

I was thinking that all the files for both installs will go in one XPI, 
so I thought that I had to know the platform in order to say something 
like, "If you're on Windows, then install the dll files, otherwise we 
don't need to install them."


> 
>>2. What is the best directory structure to contain all this stuff, and 
>>what would the install.js file look like?
>>
> 
> 
> Rather than start from scratch let's start with what you've got. The best
> directory structure is one which allows you to use the same script (or
> nearly the same) for all platform-specific binaries.
> 
> 
>>If anyone can help me out with this, please cc: me at mikep AT oeone.com 
>>or join irc.mozilla.org #calendar and have a look for me.
>>
> 
> 
> Happy to help, but would prefer to keep things in this newsgroup. Unlike IRC
> newsgroups don't depend on people being available at the same time, and
> unlike mail the answers get archived in public to help others with similar
> questions.
> 
> -Dan Veditz
> 
> 
Thanks for the help Dan.
Mike


Reply via email to