Skip to content

Commit

Permalink
Config file locating hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
1280px committed Jan 25, 2024
1 parent 097d20e commit 1e92ae2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# CapsWitch 🧙‍♀️⬆️
A simple, lightweight (13/76 KB) and configurable program that switches keyboard layout with CapsLock key — just put it in Startup folder and enjoy!
A simple, lightweight (13/78 KB) and configurable program that switches keyboard layout with CapsLock key — just put it in Startup folder and enjoy!

> **Note**: For keyboard layout switching to work in programs running with elevated privileges, CapsWitch should be ran **as administrator**. This can be done, for example, [using Task Scheduler](https://youtu.be/jt1Eb-NaBeg). <br>It runs fine **without privileges escalation** as well, however it will only work in non-elevated programs.

## Install it!
Download an archive with the preferred version:

+ [Windows 7–11 (x64)](https://github.com/1280px/CapsWitch/releases/download/m2.1/CapsWitch-64.zip) (shortlink: https://t.ly/ZrzXY)
+ [Windows XP + (x86)](https://github.com/1280px/CapsWitch/releases/download/m2.1/CapsWitch-XP.zip) (shortlink: https://t.ly/M83hf)
+ [Windows 7–11 (x64)](https://github.com/1280px/CapsWitch/releases/download/m2.1.1/CapsWitch-64.zip) (shortlink: https://t.ly/v_fmo)
+ [Windows XP + (x86)](https://github.com/1280px/CapsWitch/releases/download/m2.1.1/CapsWitch-XP.zip) (shortlink: https://t.ly/9zlcG)

Then, upzip it wherever you want (e.g. in ```shell:startup``` or ```shell:common startup```, which are Startup&nbsp;folder locations for current&nbsp;user and all&nbsp;users respectively), double-click the .exe and you're&nbsp;done!

Expand Down Expand Up @@ -36,6 +36,7 @@ CapsWitch works by emulating a layout switch keystroke *(Alt+Shift by default)*


## Configure it!
CapsWitch allows some customization using .ini settings file. By default, it looks for ```CapsWitch.ini``` file in its working directory, however you can pass custom file path using agruments (i.e. ```.\CapsWitch.exe "C:\test.ini"```). The program can also work without .ini file, using built-in default values.
CapsWitch allows some customization using .ini settings file. By default, it looks for ```<FILENAME>.ini``` file in the same directory, however you can pass custom configs file path using agruments (i.e. ```.\CapsWitch.exe "C:\test.ini"```).
<br>The program can also work without .ini file, using built-in values (same as default).

*You can see more information about each option [in default .ini file](https://github.com/1280px/CapsWitch/blob/master/CapsWitch.ini).*
6 changes: 5 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ int importSettingsFromFile(char* settingsFilePath, struct Settings* Settings)
// use default path if arguments didn't provide any
if (settingsFilePath == NULL) {
char defaultFilePath[MAX_PATH];
GetFullPathName("CapsWitch.ini", MAX_PATH, defaultFilePath, NULL);
GetModuleFileName(NULL, defaultFilePath, MAX_PATH);
// replace 3 last characters (.exe -> .ini)
defaultFilePath[strlen(defaultFilePath)-3] = 'i';
defaultFilePath[strlen(defaultFilePath)-2] = 'n';
defaultFilePath[strlen(defaultFilePath)-1] = 'i';
settingsFilePath = defaultFilePath;
}
// if it is provided, throw error if the file doesn't exist
Expand Down

0 comments on commit 1e92ae2

Please sign in to comment.