Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uwizard cannot extract files when given a network path #6

Open
OatmealDome opened this issue Oct 3, 2015 · 1 comment
Open

Uwizard cannot extract files when given a network path #6

OatmealDome opened this issue Oct 3, 2015 · 1 comment

Comments

@OatmealDome
Copy link

Uwizard fails to extract files when given a network path (ex: \psf\Home\Documents\Uwizard). When using Parallels on OS X, the "Documents" and "Desktop" folders are remapped to paths like the one just mentioned. Because of that, I had to copy my files into a folder on C:\ to be able to extract them.

Exception log:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentNullException: Value cannot be null.
Parameter name: path
   at System.IO.Directory.CreateDirectory(String path, DirectorySecurity directorySecurity)
   at System.IO.Directory.CreateDirectory(String path)
   at Uwizard.SARC.makedirexist(String dir)
   at Uwizard.SARC.extract(Byte[] infile, String outdir)
   at Uwizard.SARC.extract(String infile, String outdir)
   at Uwizard.Form1.arc_extractsarc_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
@maki-chan
Copy link

Looks like a problem with the code in Uwizard/SARC.cs from line 58-71.

        private static void makedirexist(string dir) {
            string dpath = System.IO.Path.GetFullPath(dir);
            int numdirs = 0;
            for (int c = 0; c < dpath.Length; c++)
                if (dpath[c] == '\\') numdirs++;

            for (int c = numdirs; c >= 0; c--) {
                string tmp = dpath;
                for (int cc = 0; cc < c; cc++)
                    tmp = System.IO.Path.GetDirectoryName(tmp);
                if (!System.IO.Directory.Exists(tmp))
                    System.IO.Directory.CreateDirectory(tmp);
            }
        }

I don't know why this thing is written so complicated. It seems that it tries to recursively create new directories if needed. Though System.IO.Directory.CreateDirectory() already creates directories recursively according to the .NET documentation. It should be changed to

        private static void makedirexist(string dir) {
            string dpath = System.IO.Path.GetFullPath(dir);
            if (!System.IO.Directory.Exists(dpath))
                System.IO.Directory.CreateDirectory(dpath);
            }
        }

I hope I didn't miss anything, but that should still work, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants