* fix UniwDir for win32 gdbcon.pp

This commit is contained in:
pierre 2002-04-03 09:09:22 +00:00
parent d2869c34dd
commit fb0f4271b2
2 changed files with 75 additions and 5 deletions

View File

@ -108,7 +108,7 @@ ifndef FPC_VERSION
FPC_VERSION:=$(shell $(FPC) -iV)
endif
export FPC FPC_VERSION
unexport CHECKDEPEND ALLDEPENDENCIES
unexport CHECKDEPEND ALL_DEPENDENCIES
ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
COMPILERINFO:=$(shell $(FPC) -iSP -iTP -iSO -iTO)
ifndef CPU_SOURCE
@ -324,7 +324,7 @@ else
INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
endif
else
INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source
endif
endif
endif
@ -944,7 +944,7 @@ HASEXAMPLES=1
endif
fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(TARGET_EXAMPLEDIRS))
.PHONY: fpc_all fpc_smart fpc_debug fpc_release
$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
$(FPCMADE): $(ALL_DEPENDENCIES) $(ALLTARGET)
@$(ECHOREDIR) Compiled > $(FPCMADE)
fpc_all: $(FPCMADE)
fpc_smart:
@ -1026,7 +1026,7 @@ ifdef INSTALL_FILES
endif
fpc_sourceinstall: distclean
$(MKDIR) $(INSTALL_SOURCEDIR)
$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
$(COPYTREE) $(BASEDIR) $(INSTALL_SOURCEDIR)
fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
ifdef HASEXAMPLES
$(MKDIR) $(INSTALL_EXAMPLEDIR)

View File

@ -54,8 +54,70 @@ procedure UnixDir(var s : string);
implementation
uses
{$ifdef win32}
windows,
{$endif win32}
strings;
{$ifdef win32}
const
CygDrivePrefixKey1 = 'Software';
CygDrivePrefixKey2 = 'Cygnus Solutions';
CygDrivePrefixKey3 = 'Cygwin';
CygDrivePrefixKey4 = 'mounts v2';
CygDrivePrefixKey = 'cygdrive prefix';
function CygDrivePrefix : string;
var
i : longint;
length : dword;
Value : pchar;
_type : dword;
Key,NKey : HKey;
begin
Length:=0;
Key:=HKEY_CURRENT_USER;
i := RegOpenKeyEx(Key, CygDrivePrefixKey1, 0, KEY_ENUMERATE_SUB_KEYS, @NKey);
if i=ERROR_SUCCESS then
begin
Key:=NKey;
i := RegOpenKeyEx(Key, CygDrivePrefixKey2, 0, KEY_ENUMERATE_SUB_KEYS, @NKey);
end;
if i=ERROR_SUCCESS then
begin
RegCloseKey(Key);
Key:=NKey;
i := RegOpenKeyEx(Key, CygDrivePrefixKey3, 0, KEY_ENUMERATE_SUB_KEYS, @NKey);
end;
if i=ERROR_SUCCESS then
begin
RegCloseKey(Key);
Key:=NKey;
i := RegOpenKeyEx(Key, CygDrivePrefixKey4, 0, KEY_ENUMERATE_SUB_KEYS, @NKey);
end;
if i=ERROR_SUCCESS then
begin
RegCloseKey(Key);
Key:=NKey;
i := RegQueryValueEx( Key, CygDrivePrefixKey, nil, @_type, nil, @length);
end;
if i<>ERROR_SUCCESS then
CygDrivePrefix:='/cygdrive'
else
Begin
GetMem(Value,Length);
i := RegQueryValueEx( Key, CygDrivePrefixKey, nil, @_type, LPByte(Value), @length);
if i<>ERROR_SUCCESS then
CygDrivePrefix:='/cygdrive'
else
CygDrivePrefix:=StrPas(Value);
FreeMem(Value,Length);
End;
if Key<>HKEY_CURRENT_USER then
RegCloseKey(Key);
end;
{$endif win32}
procedure UnixDir(var s : string);
var i : longint;
begin
@ -66,6 +128,11 @@ begin
if (i=length(s)) or (s[i+1]<>' ') then
{$endif win32}
s[i]:='/';
{$ifdef win32}
{ for win32 we should convert e:\ into //e/ PM }
if (length(s)>2) and (s[2]=':') and (s[3]='/') then
s:=CygDrivePrefix+'/'+s[1]+copy(s,3,length(s));
{$endif win32}
end;
constructor TGDBController.Init;
@ -263,7 +330,10 @@ end;
end.
{
$Log$
Revision 1.2 2002-03-26 16:23:14 pierre
Revision 1.3 2002-04-03 09:09:22 pierre
* fix UniwDir for win32 gdbcon.pp
Revision 1.2 2002/03/26 16:23:14 pierre
* get IDE to work with dirs containing spaces for win32
Revision 1.1 2002/01/29 17:54:49 peter