Another nicety may be handling network drives. I''ve been using a ruby script which manipulate using the "net use" command to map network drives, disconnect network drives, query to see what drives are connected, etc..., but it''d be sweet if this type of functionality was included in win32 package. Maybe usage like: nd = Win32::NetworkDrive.new( ''v:'' , ''ComputerName'', ''ShareName'' ) nd.connect( ''username'' , ''password'' ) nd.disconnect nd = Win32::NetworkDrive.new( ''v:'' , ''\\ComputerName\ShareName'', ''username'', ''passwod'' ) nd.connect nd.disconnect nd = Win32::NetworkDrive.new( ''\\ComputerName\ShareName'' ) Win32::NetworkDrive.connected?( ''v:'' ) => false nd.connect( ''v:'' ) nd.disconnect Win32::NetworkDrive.new9 ''\\ComputerName\ShareName'' ) do |nd| Dir["#{nd}"].each { |f| puts f } end or something? What do you''all think? Zach
Hi Zach,> -----Original Message----- > From: win32utils-devel-bounces@rubyforge.org > [mailto:win32utils-devel-bounces@rubyforge.org] On Behalf Of > Zach Dennis > Sent: Monday, February 07, 2005 6:42 AM > To: win32utils-devel@rubyforge.org > Subject: [Win32utils-devel] network drives > > > Another nicety may be handling network drives. I''ve been using a ruby > script which manipulate using the "net use" command to map network > drives, disconnect network drives, query to see what drives are > connected, etc..., but it''d be sweet if this type of > functionality was > included in win32 package. > > Maybe usage like: > nd = Win32::NetworkDrive.new( ''v:'' , ''ComputerName'', ''ShareName'' ) > nd.connect( ''username'' , ''password'' ) > nd.disconnect > > nd = Win32::NetworkDrive.new( ''v:'' , ''\\ComputerName\ShareName'', > ''username'', ''passwod'' ) > nd.connect > nd.disconnect > > nd = Win32::NetworkDrive.new( ''\\ComputerName\ShareName'' ) > Win32::NetworkDrive.connected?( ''v:'' ) => false > nd.connect( ''v:'' ) > nd.disconnect > > Win32::NetworkDrive.new9 ''\\ComputerName\ShareName'' ) do |nd| > Dir["#{nd}"].each { |f| puts f } > end > > or something? What do you''all think? > > ZachThat looks nice. I''m wondering if we should have an all encompassing "win32-drive" package that includes this and the driveinfo stuff from Heesob. That might make compatibility with Mike Hall''s "filesystem" package more of a pain, though. Any thoughts? Regards, Dan
Berger, Daniel wrote:> That looks nice. I''m wondering if we should have an all encompassing > "win32-drive" package that includes this and the driveinfo stuff from > Heesob. That might make compatibility with Mike Hall''s "filesystem" > package more of a pain, though. > > Any thoughts?I''m not stuck on my mentioned implementation, I just wanted to get out what I was thinking so we had a better chance of being on the same page discussing things. I like clear-all-out-in-the-open-communication. =) On a quick side note, Mike needs to update his link on the RAA. He say he has version 0.5 which was released June of last year, yet the download links is for 0.3. So my comments will be on his 0.3 documentation. The filesystem package appears to only give you information on a filesystem, but doesn''t let you do anything about it. I think Park Heesob''s recent work would be more of the stuff to keep compatible with the filesystem package, and depending on where you wanted to allow the functionality to connect network drives would determine if you''d be expanding the filesystem package or if it''d be another package in win32-drive. The mounting of network resources could be handled low level making win api calls or as an interface to the ''net'' command, since I believe all versions of windows have ''net''. I like the idea of interface compatibility, since I''m a windows and *nix user it''s nice to think of consistent naming conventions. I think that FileSystemMount is a misleading name though in Windows. FileSystemMount appears to be an object wrapping an actual mount point, and providing user information based on the methods; device, mount, fstype, etc.. mount also seems like the method to mount the network drive, and FileSystemMount sounds like the place you''d do that. win32-drive::FileSystemMount.mount( ''v:'', ''ComputerName'', ''ShareName'' ) seems intuitive don''t it? Now I haven''t used the ''filesystem'' package so perhaps you can do something like that. If we keep existing functionality, I''d say we expand on it if it makes the best design decision. If the methods; connect, disconnect were added to FileSystemMount I''d think we could get away with keeping interface consistency with the filesystem package and not giving methods duplicate behavior. If I want to map a network drive I''d like to create a FileSystemMount object and call ''connected?'' or ''mounted?'' to see if it''s connected, otherwise i''d like to ''mount'' it or ''connect'' to make it so. What your guys''s thoughts? Zach
Zach Dennis wrote:> mount also seems like the method to mount the network drive, and > FileSystemMount sounds like the place you''d do that. > > win32-drive::FileSystemMount.mount( ''v:'', ''ComputerName'', ''ShareName'' ) >What seems more intuitive is: win32-drive::FileSystem.mount( ''v:'', ''ComputerName'', ''ShareName'' ) so maybe include that as a package? win32-drive::FileSystem or just win32-drive::mount( ''v'', ''ComputerName'', ''ShareName'' ) ? Zach
> -----Original Message----- > From: win32utils-devel-bounces@rubyforge.org > [mailto:win32utils-devel-bounces@rubyforge.org] On Behalf Of > Zach Dennis > Sent: Tuesday, February 08, 2005 8:07 AM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] network drives > > > Berger, Daniel wrote: > > > That looks nice. I''m wondering if we should have an all > encompassing > > "win32-drive" package that includes this and the driveinfo > stuff from > > Heesob. That might make compatibility with Mike Hall''s > "filesystem" > > package more of a pain, though. > > > > Any thoughts? > > I''m not stuck on my mentioned implementation, I just wanted > to get out > what I was thinking so we had a better chance of being on the > same page > discussing things. I like clear-all-out-in-the-open-communication. =)That''s fine. :)> On a quick side note, Mike needs to update his link on the > RAA. He say > he has version 0.5 which was released June of last year, yet the > download links is for 0.3. So my comments will be on his 0.3 > documentation.Hm...I think I even sent him an email about that a while ago. Anyway, you can get 0.5 by going to his home page and getting it directly: http://users.rcn.com/m3ha11/ruby/ruby.html I don''t think the API changed between 0.3 and 0.5, however. If I recall, it was just macro tweaks to make it compatible with more *nix flavors. Dan