Skip to content

Commit

Permalink
Updated refresh_file_explorer application. Now showing current File E…
Browse files Browse the repository at this point in the history
…xplorer paths in window. #115.
  • Loading branch information
end2endzone committed Jan 8, 2024
1 parent 091e43d commit c91c7a1
Show file tree
Hide file tree
Showing 13 changed files with 660 additions and 25 deletions.
13 changes: 13 additions & 0 deletions src/refresh_file_explorer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
find_package(rapidassist REQUIRED)

set(REFRESH_FILE_EXP_RESOURCE_FILES ""
resource.h
resource.ico
resource.rc
)

add_executable(refresh_file_explorer WIN32
${SHELLANYTHING_EXPORT_HEADER}
${SHELLANYTHING_VERSION_HEADER}
${SHELLANYTHING_CONFIG_HEADER}
${REFRESH_FILE_EXP_RESOURCE_FILES}
file_explorer.cpp
file_explorer.h
framework.h
main.cpp
main.h
targetver.h
user.cpp
user.h
)

# Group external files as filter for Visual Studio
source_group("Resource Files" FILES ${REFRESH_FILE_EXP_RESOURCE_FILES})

# Force UNICODE for target
target_compile_definitions(refresh_file_explorer PRIVATE -D_UNICODE -DUNICODE)

Expand Down
18 changes: 18 additions & 0 deletions src/refresh_file_explorer/file_explorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,21 @@ void TestOpenFolderUnicode()
ShowErrorMessage(message);
}
}

void PrintPathsToString(const Utf8FileList& paths, tstring_t& str)
{
str.clear();

for (size_t i = 0; i < paths.size(); i++)
{
const std::string& path_utf8 = paths[i];

#ifdef UNICODE
str += ra::unicode::Utf8ToUnicode(path_utf8);
str += L"\r\n";
#else
str += ra::unicode::Utf8ToAnsi(path_utf8);
str += "\r\n";
#endif
}
}
9 changes: 9 additions & 0 deletions src/refresh_file_explorer/file_explorer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "user.h"

#include <string>
#include <vector>

Expand All @@ -24,3 +26,10 @@ bool OpenFileExplorerWindow(const std::string& path);
/// Test to open directory unicode directory `D:\Ψ`.
/// </summary>
void TestOpenFolderUnicode();

/// <summary>
/// Print the list of given paths to a string
/// </summary>
/// <param name="paths">The list of paths to print.</param>
/// <param name="str">The output string.</param>
void PrintPathsToString(const Utf8FileList& paths, tstring_t& str);
15 changes: 15 additions & 0 deletions src/refresh_file_explorer/framework.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// header.h : include file for standard system include files,
// or project specific include files
//

#pragma once

#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <windows.h>
// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
Loading

0 comments on commit c91c7a1

Please sign in to comment.