summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.cpp4
-rw-r--r--src/main_windows.cpp10
-rw-r--r--src/platform.h1
3 files changed, 15 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 56be834..317a56e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -267,7 +267,11 @@ void ts_create_gui(int window_w, int window_h) {
{
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
ImGui::PushItemWidth(-1);
+
+ bool dir_exists = ts_platform_dir_exists(path_buffer);
+ if (!dir_exists) ImGui::PushStyleColor(ImGuiCol_Border, ImGui::Spectrum::Color(0xCC2222));
ImGui::InputTextWithHint("path-ti", "Path", path_buffer, MAX_INPUT_LENGTH);
+ if (!dir_exists) ImGui::PopStyleColor();
ImGui::PopItemWidth();
ImGui::SetItemTooltip("Absolute path to directory to search");
diff --git a/src/main_windows.cpp b/src/main_windows.cpp
index c574b2f..7c6fba2 100644
--- a/src/main_windows.cpp
+++ b/src/main_windows.cpp
@@ -52,6 +52,16 @@ static const char* _ts_platform_get_config_file_path(char* buffer) {
return 0;
}
+bool ts_platform_dir_exists(utf8_int8_t* dir)
+{
+ DWORD ftyp = GetFileAttributesA(dir);
+ if (ftyp == INVALID_FILE_ATTRIBUTES)
+ return false;
+ if (ftyp & FILE_ATTRIBUTE_DIRECTORY)
+ return true;
+ return false;
+}
+
uint64_t ts_platform_get_time(uint64_t compare)
{
LARGE_INTEGER stamp;
diff --git a/src/platform.h b/src/platform.h
index e9d7ba5..7fdc15a 100644
--- a/src/platform.h
+++ b/src/platform.h
@@ -31,6 +31,7 @@ typedef enum t_ts_file_open_error
extern bool program_running;
+bool ts_platform_dir_exists(utf8_int8_t* dir);
ts_file_content ts_platform_read_file(char *path, const char *mode);
void ts_platform_list_files_block(ts_search_result* result, wchar_t* start_dir = nullptr);
void ts_platform_list_files(ts_search_result* result);