Use relative Path in Microsoft Surface application?

Posted by Roflcoptr on Stack Overflow See other posts from Stack Overflow or by Roflcoptr
Published on 2010-12-29T13:42:41Z Indexed on 2010/12/29 13:54 UTC
Read the original article Hit count: 271

Filed under:
|
|
|

I convert my wave file into a mp3 file by the following code:

internal bool convertToMp3()
        {
            string lameEXE = @"C:\Users\Roflcoptr\Documents\Visual Studio 2008\Projects\Prototype_Concept_2\Prototype_Concept_2\lame\lame.exe";
            string lameArgs = "-V2";

            string wavFile = fileName;
            string mp3File = fileName.Replace("wav", "mp3");

            Process process = new Process();
            process.StartInfo = new ProcessStartInfo();
            process.StartInfo.FileName = lameEXE;
            process.StartInfo.Arguments = string.Format("{0} {1} {2}", lameArgs, wavFile, mp3File);

            process.Start();
            process.WaitForExit();

            int exitCode = process.ExitCode;
            if (exitCode == 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

This works, but now I'd like to not use the absolut path to the lame.exe but a relative path. I included a lame.exe in the folder /lame/ on the root of the project. How can I reference it?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET