2004-08-16 17:41:11 +01:00
|
|
|
// =================================================================
|
|
|
|
// Logtalk - Object oriented extension to Prolog
|
2005-04-23 00:57:45 +01:00
|
|
|
// Release 2.24.0
|
2004-08-16 17:41:11 +01:00
|
|
|
//
|
2005-01-13 12:22:42 +00:00
|
|
|
// Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
|
2004-08-16 17:41:11 +01:00
|
|
|
// =================================================================
|
|
|
|
|
|
|
|
var WshShell = new ActiveXObject("WScript.Shell");
|
|
|
|
|
|
|
|
var WshSystemEnv = WshShell.Environment("SYSTEM");
|
|
|
|
var WshUserEnv = WshShell.Environment("USER");
|
|
|
|
var logtalk_home;
|
2004-11-29 20:36:31 +00:00
|
|
|
var logtalk_user;
|
|
|
|
|
2004-12-05 21:52:49 +00:00
|
|
|
if (WshSystemEnv.Item("LOGTALKHOME"))
|
2004-08-16 17:41:11 +01:00
|
|
|
logtalk_home = WshSystemEnv.Item("LOGTALKHOME");
|
|
|
|
else if (WshUserEnv.Item("LOGTALKHOME"))
|
|
|
|
logtalk_home = WshUserEnv.Item("LOGTALKHOME")
|
|
|
|
else {
|
|
|
|
WScript.Echo("Error! The environment variable LOGTALKHOME must be defined first!");
|
|
|
|
usage_help();
|
|
|
|
WScript.Quit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (WScript.Arguments.Unnamed.Length > 0)
|
|
|
|
usage_help();
|
|
|
|
|
2004-11-29 20:36:31 +00:00
|
|
|
if (WshUserEnv.Item("LOGTALKUSER"))
|
|
|
|
logtalk_user = WshUserEnv.Item("LOGTALKUSER");
|
|
|
|
else {
|
|
|
|
logtalk_user = WshShell.SpecialFolders("MyDocuments") + "\\logtalk";
|
|
|
|
WshUserEnv.Item("LOGTALKUSER") = WshShell.SpecialFolders("MyDocuments") + "\\logtalk";
|
|
|
|
WScript.Echo("Defined user environment variable LOGTALKUSER.");
|
|
|
|
WScript.Echo("");
|
|
|
|
}
|
2004-08-16 17:41:11 +01:00
|
|
|
|
|
|
|
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
|
|
|
|
|
|
|
if (fso.FolderExists(logtalk_user)) {
|
2005-02-10 00:02:06 +00:00
|
|
|
WScript.Echo("Error! Logtalk directory already exists!");
|
|
|
|
WScript.Echo("Please rename it and run this script again.");
|
2004-08-16 17:41:11 +01:00
|
|
|
WScript.Echo("");
|
|
|
|
usage_help();
|
|
|
|
}
|
|
|
|
|
2004-11-29 20:36:31 +00:00
|
|
|
WScript.Echo("Creating LOGTALKUSER directory:");
|
|
|
|
WScript.Echo("");
|
|
|
|
WScript.Echo(" " + logtalk_user);
|
|
|
|
WScript.Echo("");
|
|
|
|
|
2004-08-16 17:41:11 +01:00
|
|
|
fso.CreateFolder(logtalk_user);
|
|
|
|
|
2004-11-29 20:36:31 +00:00
|
|
|
WScript.Echo("Copying Logtalk files and directories...");
|
|
|
|
fso.CopyFolder(logtalk_home + "\\configs", logtalk_user + "\\configs");
|
2005-04-23 00:57:45 +01:00
|
|
|
fso.CopyFolder(logtalk_home + "\\contributions", logtalk_user + "\\contributions");
|
2004-08-16 17:41:11 +01:00
|
|
|
fso.CopyFolder(logtalk_home + "\\examples", logtalk_user + "\\examples");
|
2004-11-29 20:36:31 +00:00
|
|
|
fso.CopyFolder(logtalk_home + "\\libpaths", logtalk_user + "\\libpaths");
|
2004-08-16 17:41:11 +01:00
|
|
|
fso.CopyFolder(logtalk_home + "\\library", logtalk_user + "\\library");
|
|
|
|
fso.CopyFolder(logtalk_home + "\\xml", logtalk_user + "\\xml");
|
|
|
|
|
2004-11-29 20:36:31 +00:00
|
|
|
WScript.Echo("Finished copying Logtalk files directories.");
|
|
|
|
WScript.Echo("");
|
|
|
|
WScript.Echo("You may need to edit the contents of the file:");
|
|
|
|
WScript.Echo("");
|
|
|
|
WScript.Echo(" " + logtalk_user + "\\libpaths\\libpaths.pl");
|
|
|
|
WScript.Echo("");
|
|
|
|
WScript.Echo("to match your Prolog compiler and operating-system requirements or to");
|
|
|
|
WScript.Echo("add your own library paths.");
|
|
|
|
WScript.Echo("");
|
2005-02-10 00:02:06 +00:00
|
|
|
WScript.Echo("You may want to customize the default Logtalk compiler flags by editing");
|
2004-11-29 20:36:31 +00:00
|
|
|
WScript.Echo("the configuration file for your Prolog compiler found in the directory:");
|
|
|
|
WScript.Echo("");
|
|
|
|
WScript.Echo(" " + logtalk_user + "\\configs");
|
2004-08-16 17:41:11 +01:00
|
|
|
WScript.Echo("");
|
|
|
|
|
|
|
|
WScript.Quit(0);
|
|
|
|
|
|
|
|
function usage_help() {
|
|
|
|
WScript.Echo("");
|
2004-11-29 20:36:31 +00:00
|
|
|
WScript.Echo("This script copies the Logtalk user-modifiable files and directories");
|
|
|
|
WScript.Echo("to the user home directory. The location can be set by the environment");
|
|
|
|
WScript.Echo("variable \%LOGTALKUSER\% (defaults to MyDocuments\\logtalk when the");
|
|
|
|
WScript.Echo("variable is not defined)");
|
2004-08-16 17:41:11 +01:00
|
|
|
WScript.Echo("");
|
|
|
|
WScript.Echo("Usage:");
|
|
|
|
WScript.Echo(" " + WScript.ScriptName + " help");
|
|
|
|
WScript.Echo(" " + WScript.ScriptName);
|
|
|
|
WScript.Echo("");
|
|
|
|
WScript.Quit(1);
|
|
|
|
}
|