Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gauthier Quesnel
irritator
Commits
969fb1b5
Commit
969fb1b5
authored
Oct 02, 2020
by
Gauthier Quesnel
Browse files
macos: fix char8_t missings functions
parent
8e374ea3
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/gui/dialog-file.cpp
View file @
969fb1b5
...
...
@@ -25,8 +25,14 @@ struct file_dialog
std
::
vector
<
std
::
filesystem
::
path
>
paths
;
std
::
filesystem
::
path
current
;
std
::
filesystem
::
path
selected
;
#if defined(__APPLE__)
// @TODO Remove this part when XCode allows u8string concatenation.
std
::
string
temp
;
char
buffer
[
512
];
#else
std
::
u8string
temp
;
char8_t
buffer
[
512
];
#endif
bool
is_open
=
true
;
...
...
@@ -64,12 +70,23 @@ struct file_dialog
return
true
;
const
char8_t
**
filters
=
file_filters
;
#if defined(__APPLE__)
// @TODO Remove this part when XCode allows u8string find/compare.
while
(
*
filters
)
{
if
(
p
.
u8string
().
find
(
reinterpret_cast
<
const
char
*>
(
*
filters
))
==
0
)
return
true
;
++
filters
;
}
#else
while
(
*
filters
)
{
if
(
p
.
u8string
().
find
(
*
filters
)
==
0
)
return
true
;
++
filters
;
}
#endif
return
false
;
}
...
...
@@ -80,12 +97,23 @@ struct file_dialog
return
true
;
const
char8_t
**
filters
=
extension_filters
;
#if defined(__APPLE__)
// @TODO Remove this part when XCode allows u8string find/compare.
while
(
*
filters
)
{
if
(
p
.
extension
().
u8string
()
==
reinterpret_cast
<
const
char
*>
(
*
filters
))
return
true
;
++
filters
;
}
#else
while
(
*
filters
)
{
if
(
p
.
extension
().
u8string
()
==
*
filters
)
return
true
;
++
filters
;
}
#endif
return
false
;
}
...
...
@@ -235,8 +263,14 @@ load_file_dialog(std::filesystem::path& out)
++
it
)
{
fd
.
temp
.
clear
();
if
(
std
::
filesystem
::
is_directory
(
*
it
))
{
#if defined(__APPLE__)
// @TODO Remove this part when XCode allows u8string concatenation.
fd
.
temp
=
"[Dir] "
;
fd
.
temp
+=
reinterpret_cast
<
const
char
*>
(
it
->
filename
().
u8string
().
c_str
());
#else
fd
.
temp
=
u8"[Dir] "
;
fd
.
temp
+=
it
->
filename
().
u8string
();
#endif
}
else
fd
.
temp
=
it
->
filename
().
u8string
();
...
...
@@ -348,7 +382,12 @@ save_file_dialog(std::filesystem::path& out)
++
it
)
{
fd
.
temp
.
clear
();
if
(
std
::
filesystem
::
is_directory
(
*
it
))
#if defined(__APPLE__)
// @TODO Remove this part when XCode allows u8string concatenation.
fd
.
temp
=
"[Dir] "
;
#else
fd
.
temp
=
u8"[Dir] "
;
#endif
fd
.
temp
=
it
->
filename
().
u8string
();
...
...
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