Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
ITABase
Commits
02c7e292
Commit
02c7e292
authored
Jul 04, 2016
by
Dipl.-Ing. Jonas Stienen
Browse files
upd: fixing little INI file read section problem when path separators are not correct
parent
3cc8e808
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ITAConfigUtilsWin32Impl.cpp
View file @
02c7e292
...
...
@@ -34,11 +34,13 @@
const
unsigned
int
MAX_VALUE_STRING_LENGTH
=
4096
;
// Bugfix (fwe): Falls kein Pfad und nur ein Dateinamen angebenen ist, muss .\ vorne angehngt werden
std
::
string
fixpath
(
const
std
::
string
&
sPath
)
{
if
(
sPath
.
find_first_of
(
PATH_SEPARATOR
)
!=
-
1
)
return
sPath
;
std
::
string
FixPath
(
const
std
::
string
&
sPath
)
{
std
::
string
sCorrectedPathWithSystemSeparator
=
correctPath
(
sPath
);
if
(
sCorrectedPathWithSystemSeparator
.
find_first_of
(
PATH_SEPARATOR
)
!=
-
1
)
return
sCorrectedPathWithSystemSeparator
;
else
return
std
::
string
(
"."
)
+
PATH_SEPARATOR
+
sPath
;
return
std
::
string
(
"."
)
+
PATH_SEPARATOR
+
sPath
;
}
std
::
vector
<
std
::
string
>
INIFileGetSections
(
const
std
::
string
&
sINIFilename
)
{
...
...
@@ -51,7 +53,7 @@ std::vector<std::string> INIFileGetSections(const std::string& sINIFilename) {
char
buf
[
SECTION_NAME_BUFFER_SIZE
];
std
::
vector
<
std
::
string
>
vsResult
;
if
(
GetPrivateProfileSectionNamesA
(
buf
,
SECTION_NAME_BUFFER_SIZE
,
f
ix
p
ath
(
sINIFilename
).
c_str
())
>
0
)
{
if
(
GetPrivateProfileSectionNamesA
(
buf
,
SECTION_NAME_BUFFER_SIZE
,
F
ix
P
ath
(
sINIFilename
).
c_str
())
>
0
)
{
char
*
p
=
buf
;
unsigned
int
l
;
...
...
@@ -74,7 +76,7 @@ std::vector<std::string> INIFileGetKeys(const std::string& sINIFilename, const s
char
buf
[
SECTION_BUFFER_SIZE
];
std
::
vector
<
std
::
string
>
vsResult
;
if
(
GetPrivateProfileSectionA
(
sSection
.
c_str
(),
buf
,
SECTION_BUFFER_SIZE
,
f
ix
p
ath
(
sINIFilename
).
c_str
())
>
0
)
{
if
(
GetPrivateProfileSectionA
(
sSection
.
c_str
(),
buf
,
SECTION_BUFFER_SIZE
,
F
ix
P
ath
(
sINIFilename
).
c_str
())
>
0
)
{
char
*
p
=
buf
;
unsigned
int
l
;
...
...
@@ -107,7 +109,7 @@ std::string INIFileReadString(const std::string& sINIFilename, const std::string
sDefaultValue
.
c_str
(),
(
LPSTR
)
buf
,
(
DWORD
)
MAX_VALUE_STRING_LENGTH
,
f
ix
p
ath
(
sINIFilename
).
c_str
());
F
ix
P
ath
(
sINIFilename
).
c_str
());
return
std
::
string
(
buf
);
}
...
...
@@ -119,7 +121,7 @@ bool INIFileWriteString(const std::string& sINIFilename, const std::string& sSec
return
(
WritePrivateProfileStringA
(
sSection
.
c_str
(),
sKey
.
c_str
(),
s
.
c_str
(),
f
ix
p
ath
(
sINIFilename
).
c_str
())
==
TRUE
);
F
ix
P
ath
(
sINIFilename
).
c_str
())
==
TRUE
);
}
#endif // _WIN32
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment