- Timestamp:
- 03/20/08 12:08:21 (17 years ago)
- Branches:
- master, help
- Children:
- c8e8fa8
- Parents:
- 20b4e44
- git-author:
- pawelk <pawelk@…> (03/20/08 12:08:21)
- git-committer:
- pawelk <pawelk@…> (03/20/08 12:08:21)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
app/dist/common/utt_make_config.pl
rd593c5e r389de9a 12 12 13 13 prepareUttUsrHome($usr_home); 14 conf_utt(catfile($usr_home, 'utt.conf'), $sys_home); 15 14 16 conf_cor(catfile($usr_home, 'cor.conf'), $sys_home); 15 17 conf_grp(catfile($usr_home, 'grp.conf'), $sys_home); … … 17 19 conf_lem(catfile($usr_home, 'lem.conf'), $sys_home); 18 20 conf_ser(catfile($usr_home, 'ser.conf'), $sys_home); 19 conf_utt(catfile($usr_home, 'utt.conf'), $sys_home);20 21 21 22 print "UTT user configuration created in $usr_home\n"; … … 27 28 my $dir = shift; 28 29 29 if(-d $dir) { 30 print "Old configuration will be deleted!\n"; 31 my $cnt = unlink <$dir/*>; 32 print "$cnt files deleted.\n"; 30 print "Preparing user configuration.\n"; 31 32 if(-d $dir) { 33 print "Old configuration detected. "; 34 my $cnt = unlink <$dir/*>; 35 print "($cnt files deleted)\n"; 36 } 37 else { 38 print "Creating directory $dir\n"; 39 if(1 != mkdir $dir) { 40 die "Unable to create UTT user configuration!\n"; 33 41 } 34 else { 35 print "Creating directory $dir\n"; 36 if(1 != mkdir $dir) { 37 die "Unable to create UTT user configuration!\n"; 38 } 39 } 42 } 40 43 } 41 44 … … 114 117 my $utt_file = shift; 115 118 my $utthome = shift; 119 120 my $lang = getUserLanguage(abs_path(catdir($utthome, "share/utt"))); 121 116 122 open(FILE, ">$utt_file"); 117 123 118 124 print FILE makeConfigHeader(); 119 print FILE "# user locale \n";120 print FILE "language=", findLocale(), "\n";125 print FILE "# user locale (dictionary)\n"; 126 print FILE "language=", $lang, "\n"; 121 127 122 128 close FILE; 129 } 130 131 sub getUserLanguage() { 132 my $dict_dir = shift; 133 134 print "Setup dictionaries.\n"; 135 136 opendir(DIR, $dict_dir) || die "Install dictionary first!\n"; 137 @files = grep(/[^\.{1,2}]/ && -d "$dict_dir/$_", readdir(DIR)); 138 closedir DIR; 139 my $cnt = scalar @files; 140 print "$cnt dictionary(ies) found.\n"; 141 if(0 == $cnt) { 142 die("Install dictionary first!\n"); 143 } 144 145 foreach my $file (@files) { 146 print "Do you select dictionary $file [yes/no]? "; 147 my $ans = <STDIN>; 148 if($ans =~ /y(es)?/i) { 149 return $file; 150 } 151 } 152 die "No dictionary selected - setup failed!\n"; 123 153 } 124 154
Note: See TracChangeset
for help on using the changeset viewer.