Fixed issue with ini config component and include functionality.

Added {CMS_SETUP}.cms_config_ini_name to define the CMS Configuration file name,
   and provide an easy way to change the name.
This commit is contained in:
2015-03-09 19:27:30 +01:00
parent ca10c57b4b
commit bd6524ebe7
2 changed files with 22 additions and 6 deletions

View File

@@ -44,8 +44,8 @@ note
@include=file-to-include @include=file-to-include
]" ]"
date: "$Date: 2014-12-18 16:37:11 +0100 (jeu., 18 déc. 2014) $" date: "$Date: 2015-03-09 19:25:49 +0100 (lun., 09 mars 2015) $"
revision: "$Revision: 96383 $" revision: "$Revision: 96797 $"
class class
INI_CONFIG INI_CONFIG
@@ -314,10 +314,13 @@ feature {NONE} -- Implementation
f: PLAIN_TEXT_FILE f: PLAIN_TEXT_FILE
l_last_section_name: like last_section_name l_last_section_name: like last_section_name
retried: BOOLEAN retried: BOOLEAN
l_old_associated_path: like associated_path
do do
l_old_associated_path := associated_path
if retried then if retried then
has_error := True has_error := True
else else
associated_path := p
l_last_section_name := last_section_name l_last_section_name := last_section_name
last_section_name := Void last_section_name := Void
create f.make_with_path (p) create f.make_with_path (p)
@@ -337,6 +340,7 @@ feature {NONE} -- Implementation
end end
end end
last_section_name := l_last_section_name last_section_name := l_last_section_name
associated_path := l_old_associated_path
rescue rescue
retried := True retried := True
retry retry
@@ -351,6 +355,7 @@ feature {NONE} -- Implementation
lst: LIST [STRING_8] lst: LIST [STRING_8]
tb: STRING_TABLE [STRING_8] tb: STRING_TABLE [STRING_8]
i,j: INTEGER i,j: INTEGER
p: PATH
l_section_name: like last_section_name l_section_name: like last_section_name
do do
obj := Void obj := Void
@@ -384,7 +389,11 @@ feature {NONE} -- Implementation
if k.is_case_insensitive_equal_general ("@include") then if k.is_case_insensitive_equal_general ("@include") then
import_path (create {PATH}.make_from_string (v), last_section_name) create p.make_from_string (v)
if not p.is_absolute and attached associated_path as l_path then
p := l_path.parent.extended_path (p)
end
import_path (p, last_section_name)
else else
i := k.index_of ('[', 1) i := k.index_of ('[', 1)
if i > 0 then if i > 0 then

View File

@@ -7,8 +7,8 @@ note
- documentation - documentation
- themes - themes
]" ]"
date: "$Date: 2015-02-05 10:25:53 +0100 (jeu., 05 févr. 2015) $" date: "$Date: 2015-03-09 19:25:49 +0100 (lun., 09 mars 2015) $"
revision: "$Revision: 96584 $" revision: "$Revision: 96797 $"
class class
CMS_LAYOUT CMS_LAYOUT
@@ -44,12 +44,19 @@ feature -- Access
do do
p := internal_cms_config_ini_path p := internal_cms_config_ini_path
if p = Void then if p = Void then
p := config_path.extended ("cms.ini") p := config_path.extended (cms_config_ini_name)
internal_cms_config_ini_path := p internal_cms_config_ini_path := p
end end
Result := p Result := p
end end
cms_config_ini_name: STRING
-- CMS Configuration file name.
-- Redefine to easily change the name.
do
Result := "cms.ini"
end
feature {NONE} -- Implementation feature {NONE} -- Implementation
internal_theme_path: detachable like theme_path internal_theme_path: detachable like theme_path