mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-07-03 18:21:16 -03:00
Stop exporting empty variables as ENV_NULL
Localize the encoding of empty variables as ENV_NULL into the universal variables component, and ensure they are not exported as ENV_NULL. Fixes #4846
This commit is contained in:
@@ -1791,6 +1791,33 @@ bool contains(const wcstring_list_t &list, const wcstring &str) {
|
||||
return std::find(list.begin(), list.end(), str) != list.end();
|
||||
}
|
||||
|
||||
wcstring_list_t split_string(const wcstring &val, wchar_t sep) {
|
||||
wcstring_list_t out;
|
||||
size_t pos = 0, end = val.size();
|
||||
while (pos <= end) {
|
||||
size_t next_pos = val.find(sep, pos);
|
||||
if (next_pos == wcstring::npos) {
|
||||
next_pos = end;
|
||||
}
|
||||
out.emplace_back(val, pos, next_pos - pos);
|
||||
pos = next_pos + 1; // skip the separator, or skip past the end
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
wcstring join_strings(const wcstring_list_t &vals, wchar_t sep) {
|
||||
wcstring result;
|
||||
bool first = true;
|
||||
for (const wcstring &s : vals) {
|
||||
if (!first) {
|
||||
result.push_back(sep);
|
||||
}
|
||||
result.append(s);
|
||||
first = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int create_directory(const wcstring &d) {
|
||||
bool ok = false;
|
||||
struct stat buf;
|
||||
|
||||
Reference in New Issue
Block a user