Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Delphi: Общие вопросы > Сетевые пути


Автор: Wing 19.6.2006, 20:30
Помогите плз. Может кто уже сталкивался такой проблемой. Как можно отличить сетевой путь(я имею ввиду за пределами компьютера - другой компьютер, инет, ...) от локального? 

Автор: Snowy 19.6.2006, 20:38
Локальный путь начинается с 
\\localhost
\\127.
\\имя_компьютера
\\IP_компьютера
Всё остальное - удаленный 

Автор: Wing 19.6.2006, 20:47
Snowy, нет немного не то.
http://www.my.site.ru/, ftp://.../, \\чужойкомп\, ...
это сетевые
\\localhost\
это уже локальный

Например обращение к файлу C:\my.txt, file://C:\my.txt// это уже на моем компе, если конечно диск не сетевой.

Может в виндоузе чего-нибудь встроенное есть? 

Автор: Mechanic 20.6.2006, 08:56
Цитата

ExtractFileDrive returns a string containing the drive portion of a fully qualified path name for the file passed in the FileName. For file names with drive letters, the result is in the form '<drive>'. For file names with a UNC path the result is in the form '\\<servername>\<sharename>'. If the given path contains neither style of path prefix, the result is an empty string.


Цитата

GetDriveType
The GetDriveType function determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive. 

Return Values

The return value specifies the type of drive. It can be one of the following values: 

Value    Meaning
0    The drive type cannot be determined.
1    The root directory does not exist.
DRIVE_REMOVABLE    The drive can be removed from the drive.
DRIVE_FIXED    The disk cannot be removed from the drive.
DRIVE_REMOTE    The drive is a remote (network) drive.
DRIVE_CDROM    The drive is a CD-ROM drive.
DRIVE_RAMDISK    The drive is a RAM disk.

  

Автор: Демо 20.6.2006, 10:13
Mechanic

+ ExpandUNCFileName 

Автор: Wing 22.6.2006, 19:12
А как же все таки http://.../, ftp://.../, mailto:..., ..., или их просто через Copy отлавливать? 

Автор: Демо 22.6.2006, 19:24
Цитата(Wing @  22.6.2006,  19:12 Найти цитируемый пост)
А как же все таки http://.../, ftp://.../, mailto:..., ..., или их просто через Copy отлавливать? 


см. 
Цитата(Snowy @  19.6.2006,  20:38 Найти цитируемый пост)
 
Дата 19.6.2006,  20:38

Цитата(Mechanic @  20.6.2006,  08:56 Найти цитируемый пост)
Дата 20.6.2006,  08:56

Цитата(Демо @  20.6.2006,  10:13 Найти цитируемый пост)
Дата 20.6.2006,  10:13

 

Автор: Mechanic 22.6.2006, 23:22
Цитата(Wing @  22.6.2006,  19:12 Найти цитируемый пост)
А как же все таки http://.../, ftp://.../, mailto:..., ..., или их просто через Copy отлавливать?  

А это уже не совсем путь. Это уже больше на URL похоже.. smile
Для работы с URL'ами есть хорошие функи в Shell (shlwapi.dll).
Например, UrlCanonicalizeUrlIsFileUrlUrlIsOpaqueUrlApplyScheme, etc.. 

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)