problème chemin absolu du fichier après génération de Setup
Salut
J’ai un problème avec la notion de chemin absolue dans mon application.
Mon application copier un fichier ( .txt / .pdf / .doc) dans un répertoire de l’application « Files », l’opération se déroule très bien mais une fois je crée le setup, le programme me dis qu’il n’arrive pas à localiser le fichier .
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
/* Ouverture de OpenFileDialog*/
OpenFileDialog OFD = new OpenFileDialog();
OFD.ShowDialog();
/* Récupération du chemin du fichier ainsi que son extension*
string scanPath1 = OFD.FileName.ToString();
ExtScanPath1 = System.IO.Path.GetExtension(scanPath1).ToString();
OFD.ShowDialog();
/* test de l'existence du fichier et upload */
if (System.IO.File.Exists(scanPath1))
{
string appPATH = System.Windows.Forms.Application.StartupPath.ToString() + "\\" + "Files\\";
string idContractRandom = txtContract.Text;
System.IO.File.Copy(scanPath1, appPATH + "FileScan1Contract" + txtContract.Text + ExtScanPath1);
}
Je me demande y a-t-il possibilité de dire au programme :
Copie moi le fichier x à ( je donne le chemin relatif ex : @".\Files") |