Skip to content

Commit 9fa9107

Browse files
Resolve compile after deprecation removal
1 parent b859745 commit 9fa9107

3 files changed

Lines changed: 8 additions & 127 deletions

File tree

source/juno/base/threading.d

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import juno.base.core,
1313
juno.base.native,
1414
juno.base.time;
1515

16+
import std.utf;
17+
1618
/**
1719
* $(RED Deprecated.
1820
* Please use core.thread.sleep instead.)
@@ -140,11 +142,11 @@ final class ManualResetEvent : EventWaitHandle {
140142
final class Mutex : WaitHandle {
141143

142144
this(bool initiallyOwned = false, string name = null) {
143-
Handle hMutex = CreateMutex(null, (initiallyOwned ? 1 : 0), name.toUtf16z());
145+
Handle hMutex = CreateMutex(null, (initiallyOwned ? 1 : 0), name.toUTF16z());
144146
uint error = GetLastError();
145147

146148
if (error == ERROR_ACCESS_DENIED && (hMutex == Handle.init || hMutex == INVALID_HANDLE_VALUE))
147-
hMutex = OpenMutex(MUTEX_MODIFY_STATE | SYNCHRONIZE, 0, name.toUtf16z());
149+
hMutex = OpenMutex(MUTEX_MODIFY_STATE | SYNCHRONIZE, 0, name.toUTF16z());
148150

149151
handle_ = hMutex;
150152
}
@@ -158,7 +160,7 @@ final class Mutex : WaitHandle {
158160
final class Semaphore : WaitHandle {
159161

160162
this(int initialCount, int maximumCount, string name = null) {
161-
handle_ = CreateSemaphore(null, initialCount, maximumCount, name.toUtf16z());
163+
handle_ = CreateSemaphore(null, initialCount, maximumCount, name.toUTF16z());
162164
}
163165

164166
int release(int releaseCount = 1) {

source/juno/io/filesystem.d

Lines changed: 0 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,124 +1009,3 @@ interface Iterator(T) {
10091009
int opApply(int delegate(ref T) action);
10101010

10111011
}
1012-
1013-
deprecated
1014-
class FileSystemIterator : Iterator!(string) {
1015-
1016-
private string path_;
1017-
private string searchPattern_;
1018-
private bool includeFiles_;
1019-
private bool includeDirs_;
1020-
1021-
this(string path, string searchPattern, bool includeFiles, bool includeDirs) {
1022-
path_ = path;
1023-
searchPattern_ = searchPattern;
1024-
includeFiles_ = includeFiles;
1025-
includeDirs_ = includeDirs;
1026-
}
1027-
1028-
int opApply(int delegate(ref string) action) {
1029-
1030-
bool isDir(WIN32_FIND_DATA findData) {
1031-
return ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0);
1032-
}
1033-
1034-
bool isFile(WIN32_FIND_DATA findData) {
1035-
return ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0);
1036-
}
1037-
1038-
string getSearchResult(string path, WIN32_FIND_DATA findData) {
1039-
return combine(path, toUtf8(findData.cFileName[0 .. wcslen(findData.cFileName.ptr)]));
1040-
}
1041-
1042-
int ret = 0;
1043-
1044-
string fullPath = getFullPath(path_);
1045-
1046-
string searchPattern = searchPattern_.stripRight();
1047-
if (searchPattern == ".")
1048-
searchPattern = "*";
1049-
if (searchPattern.length == 0)
1050-
return ret;
1051-
1052-
string searchPath = combine(fullPath, searchPattern);
1053-
if (std.path.isDirSeparator(searchPath[$ - 1])
1054-
|| searchPath[$ - 1] == ':')
1055-
searchPath ~= '*';
1056-
1057-
string userPath = path_;
1058-
string tempPath = getDirectoryName(searchPattern);
1059-
if (tempPath.length != 0)
1060-
userPath = combine(userPath, tempPath);
1061-
1062-
WIN32_FIND_DATA findData;
1063-
uint lastError;
1064-
1065-
Handle hFind = FindFirstFile(searchPath.toUTF16z(), findData);
1066-
if (hFind != INVALID_HANDLE_VALUE) {
1067-
scope(exit) FindClose(hFind);
1068-
1069-
do {
1070-
if (wcscmp(findData.cFileName.ptr, ".") == 0
1071-
|| wcscmp(findData.cFileName.ptr, "..") == 0)
1072-
continue;
1073-
1074-
string result = getSearchResult(userPath, findData);
1075-
1076-
if ((includeDirs_ && isDir(findData))
1077-
|| (includeFiles_ && isFile(findData))) {
1078-
if ((ret = action(result)) != 0)
1079-
break;
1080-
}
1081-
} while (FindNextFile(hFind, findData));
1082-
1083-
lastError = GetLastError();
1084-
}
1085-
1086-
if (lastError != ERROR_SUCCESS
1087-
&& lastError != ERROR_NO_MORE_FILES
1088-
&& lastError != ERROR_FILE_NOT_FOUND)
1089-
ioError(lastError, userPath);
1090-
1091-
return ret;
1092-
}
1093-
1094-
}
1095-
1096-
/**
1097-
* $(RED Deprecated.
1098-
* Please use std.file.dirEntries instead.)
1099-
*
1100-
* Returns an iterable collection of directory names in the specified _path.
1101-
*/
1102-
deprecated
1103-
Iterator!(string) enumDirectories(string path, string searchPattern = "*") {
1104-
return enumFileSystemNames(path, searchPattern, false, true);
1105-
}
1106-
1107-
/**
1108-
* $(RED Deprecated.
1109-
* Please use std.file.dirEntries instead.)
1110-
*
1111-
* Returns an iterable collection of file names in the specified _path.
1112-
*/
1113-
deprecated
1114-
Iterator!(string) enumFiles(string path, string searchPattern = "*") {
1115-
return enumFileSystemNames(path, searchPattern, true, false);
1116-
}
1117-
1118-
/**
1119-
* $(RED Deprecated.
1120-
* Please use std.file.dirEntries instead.)
1121-
1122-
* Returns an iterable collection of file-system entries in the specified _path.
1123-
*/
1124-
deprecated
1125-
Iterator!(string) enumFileSystemEntries(string path, string searchPattern = "*") {
1126-
return enumFileSystemNames(path, searchPattern, true, true);
1127-
}
1128-
1129-
deprecated
1130-
private Iterator!(string) enumFileSystemNames(string path, string searchPattern, bool includeFiles, bool includeDirs) {
1131-
return new FileSystemIterator(path, searchPattern, includeFiles, includeDirs);
1132-
}

source/juno/io/path.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ string getFileName(string path) {
150150
*/
151151
deprecated
152152
string getFullPath(string path) {
153-
auto p = path.toUtf16z();
153+
auto p = path.toUTF16z();
154154

155155
auto buffer = new wchar[MaxPath + 1];
156156
auto bufferLength = GetFullPathName(p, MaxPath + 1, buffer.ptr, null);
@@ -171,10 +171,10 @@ string getFullPath(string path) {
171171
bufferLength = GetLongPathName(buffer.ptr, tempBuffer.ptr, MaxPath);
172172

173173
if (bufferLength > 0)
174-
return tempBuffer[0 .. bufferLength].toUtf8();
174+
return to!string(tempBuffer[0 .. bufferLength]);
175175
}
176176

177-
return buffer[0 .. bufferLength].toUtf8();
177+
return to!string(buffer[0 .. bufferLength]);
178178
}
179179

180180
/// Specifies constants used to retrieve directory paths to system special folders.

0 commit comments

Comments
 (0)