mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
fhem.pl: allow %L for the statefile (Forum #55360)
git-svn-id: https://svn.fhem.de/fhem/trunk@11755 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
cfe24570b8
commit
95e2907e42
22
fhem/fhem.pl
22
fhem/fhem.pl
@ -514,9 +514,14 @@ if(configDBUsed()) {
|
||||
my $ret = CommandInclude(undef, $attr{global}{configfile});
|
||||
$cfgRet .= "configfile: $ret\n" if($ret);
|
||||
|
||||
if($attr{global}{statefile} && -r $attr{global}{statefile}) {
|
||||
$ret = CommandInclude(undef, $attr{global}{statefile});
|
||||
$cfgRet .= "statefile: $ret\n" if($ret);
|
||||
my $stateFile = $attr{global}{statefile};
|
||||
if($stateFile) {
|
||||
my @t = localtime;
|
||||
$stateFile = ResolveDateWildcards($stateFile, @t);
|
||||
if(-r $stateFile) {
|
||||
$ret = CommandInclude(undef, $stateFile);
|
||||
$cfgRet .= "$stateFile: $ret\n" if($ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1347,9 +1352,14 @@ WriteStatefile()
|
||||
return cfgDB_SaveState();
|
||||
}
|
||||
|
||||
return "No statefile specified" if(!$attr{global}{statefile});
|
||||
if(!open(SFH, ">$attr{global}{statefile}")) {
|
||||
my $msg = "WriteStateFile: Cannot open $attr{global}{statefile}: $!";
|
||||
my $stateFile = AttrVal('global','statefile',undef);
|
||||
return "No statefile specified" if(!defined($stateFile));
|
||||
|
||||
my @t = localtime;
|
||||
$stateFile = ResolveDateWildcards($stateFile, @t);
|
||||
|
||||
if(!open(SFH, ">$stateFile")) {
|
||||
my $msg = "WriteStateFile: Cannot open $stateFile: $!";
|
||||
Log 1, $msg;
|
||||
return $msg;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user