-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPathUtils.h
More file actions
47 lines (37 loc) · 1.2 KB
/
PathUtils.h
File metadata and controls
47 lines (37 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include <string>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <shobjidl.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shellapi.h>
// Function to get the Downloads folder path for the current user
std::string GetDownloadsPath();
// ---- Get PATH variable ----
/*
std::string GetPathVariable()
{
char* buffer = nullptr;
size_t size = 0;
if (_dupenv_s(&buffer, &size, "PATH") != 0 || !buffer)
return "";
std::string path(buffer);
free(buffer);
return path;
}
*/
// Get User and Admin PATH variables separately (Windows-specific)
std::string GetUserPathVariable();
std::string GetAdminPathVariable();
// Function to split a PATH variable into individual entries
std::vector<std::string> SplitPath(const std::string& path);
// Update Path Variables for the Logged User
bool SetUserPath(const std::string& newPath);
// Function to open a file in the default editor
void OpenFileInDefaultEditor(const std::string& filepath);
// Function to open a folder in Windows Explorer
void OpenFolderDialog(const std::string& outPath);
// Function to open a folder selection dialog and return the selected path
bool OpenFolderDialog(std::string& outPath);