mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 1,359
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,359
I can't believe I've never noticed this before (because everything appeared to be working fine for months), but apparently mIRC does not set the working directory to the mirc.ini location?

Is there a way to avoid using full paths? A function I can call which will return what mIRC thinks is the working directory? Can mIRC call SetCurrentDirectory or may that break existing libraries?

Code:
#include <stdio.h>
#include <direct.h>

char cCurrentPath[FILENAME_MAX];
 _getcwd(cCurrentPath, sizeof(cCurrentPath));

FILE *file;
int error = _tfopen_s(&file, TEXT("encrypted"), TEXT("wb"));

Joined: Jul 2006
Posts: 4,163
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,163
That's probably correct. If you use -i in command line argument, the directory of mirc.ini is not the current working directory.
What's the value of the current working directory anyway, $mircdir?

Last edited by Wims; 18/03/14 06:50 AM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2004
Posts: 1,359
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,359
$mircdir is in %appdata% but using a relative path in the dll it tries to access %programfiles% and results in access errors (using the default shortcut from the start menu)

Joined: Jul 2006
Posts: 4,163
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,163
Well, yeah it makes sense it's the exe's directory and that means existing dlls could break if you change the CWD.
mIRC allows you to evaluate identifier from the dll so just grab $mircdir's value with that smile


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2004
Posts: 1,359
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,359
Oh right, thanks.


Link Copied to Clipboard