Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
ITABase
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
ITABase
Commits
02c7e292
Commit
02c7e292
authored
Jul 04, 2016
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
src/ITAConfigUtilsWin32Impl.cpp
src/ITAConfigUtilsWin32Impl.cpp
+10
-8
No files found.
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
,
fixp
ath
(
sINIFilename
).
c_str
())
>
0
)
{
if
(
GetPrivateProfileSectionNamesA
(
buf
,
SECTION_NAME_BUFFER_SIZE
,
FixP
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
,
fixp
ath
(
sINIFilename
).
c_str
())
>
0
)
{
if
(
GetPrivateProfileSectionA
(
sSection
.
c_str
(),
buf
,
SECTION_BUFFER_SIZE
,
FixP
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
,
fixp
ath
(
sINIFilename
).
c_str
());
FixP
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
(),
fixp
ath
(
sINIFilename
).
c_str
())
==
TRUE
);
FixP
ath
(
sINIFilename
).
c_str
())
==
TRUE
);
}
#endif // _WIN32
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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