Droit de dossier.

Résolu/Fermé
Exileur Messages postés 1475 Date d'inscription mercredi 31 août 2011 Statut Membre Dernière intervention 16 décembre 2022 - Modifié par Exileur le 24/10/2012 à 11:51
Exileur Messages postés 1475 Date d'inscription mercredi 31 août 2011 Statut Membre Dernière intervention 16 décembre 2022 - 25 oct. 2012 à 01:53
Bonjour,

Je suis actuellement en train de développer un launcher minecraft, qui entre autre, met automatiquement à jour le jeux SAUF QUE..

J'ai donc mon dossier dans le %appdata%, qui est en lecture seule, quand le dossier et pas la et que je lance le code, tous ce passe bien, mais quand le dossier à déjà été créé, impossible de le supprimé... Il supprime tous les fichiers à l'intérieur mais ne supprime pas les dossier et ne télécharge pas les nouveaux fichier....

J'ai donc penser à trois solution.. La première, créer un dossier avant de télécharger les fichiers à l'intérieur, ce qui aurait pu éventuellement me permettre de lui attribuer les droits manuellement, mais en vain je n'ai rien trouver sur internet.
La deuxième, lancer l'application en admin, mais ça ne fonctionne pas plus..
Et la troisième du force delete mais google n'a pas pu m'aider..

Je suis donc perdu et requière votre aide programmeur de France et du monde !!!! Mouaahaa (après +10h de développement on fini bien par péter un plomb :))

J'ai eu ce message d'erreur qui ne m'a pas bien éclairé dans la boite d'exécution vb.net :

Une exception de première chance de type 'System.IO.DirectoryNotFoundException' s'est produite dans Microsoft.VisualBasic.dll
(l'autre me prend vraiment pour un con en me parlant de premiére chance >_<)

Voila mon code :

Sub MAJ()  

        If System.IO.Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\") = True Then  
            My.Computer.FileSystem.DeleteDirectory("%appdata%\.minecraft", FileIO.DeleteDirectoryOption.DeleteAllContents)  
            My.Computer.FileSystem.DeleteDirectory("%appdata%\.minecraft", FileIO.UIOption.AllDialogs, FileIO.RecycleOption.SendToRecycleBin)  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/Minecraft.exe", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\minecraft.exe")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/lwjgl.jar", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\lwjgl.jar")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/version", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\version")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/jinput.jar", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\jinput.jar")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/minecraft.jar", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\minecraft.jar")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/lwjgl_util.jar", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\lwjgl_util.jar")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-dx8.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\jinput-dx8.dll")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-raw.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\jinput-raw.dll")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/lwjgl64.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\lwjgl64.dll")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/OpenAL32.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\OpenAL32.dll")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-dx8_64.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\jinput-dx8_64.dll")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-raw_64.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\jinput-raw_64.dll")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/lwjgl.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\lwjgl.dll")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/OpenAL64.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\OpenAL64.dll")  

        ElseIf System.IO.Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\") = False Then  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/Minecraft.exe", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\minecraft.exe")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/lwjgl.jar", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\lwjgl.jar")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/version", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\version")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/jinput.jar", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\jinput.jar")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/minecraft.jar", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\minecraft.jar")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/lwjgl_util.jar", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\lwjgl_util.jar")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-dx8.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\jinput-dx8.dll")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-raw.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\jinput-raw.dll")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/lwjgl64.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\lwjgl64.dll")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/OpenAL32.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\OpenAL32.dll")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-dx8_64.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\jinput-dx8_64.dll")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-raw_64.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\jinput-raw_64.dll")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/lwjgl.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\lwjgl.dll")  
            My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/OpenAL64.dll", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\bin\natives\OpenAL64.dll")  
        End If  
        MsgBox("Mise a jour terminée", MsgBoxStyle.Information)  
        FormConn = 1  
    End Sub



Merci à vous



N'oubliez pas de marquez votre post comme résolut lorsque vous avez eu les réponses à vos questions...
Au royaume des aveugles, les borgnes sont rois.

1 réponse

Exileur Messages postés 1475 Date d'inscription mercredi 31 août 2011 Statut Membre Dernière intervention 16 décembre 2022 150
25 oct. 2012 à 01:53
Résolu

Sub MAJ()
Dim path As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

If System.IO.Directory.Exists(path & "\.minecraft.yirs") = True Then
My.Computer.FileSystem.DeleteDirectory(path & "\.minecraft.yirs", FileIO.DeleteDirectoryOption.DeleteAllContents)
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/Minecraft.exe", path & "\.minecraft.yirs\bin\minecraft.exe")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/lwjgl.jar", path & "\.minecraft.yirs\bin\lwjgl.jar")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/version", path & "\.minecraft.yirs\bin\version")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/jinput.jar", path & "\.minecraft.yirs\bin\jinput.jar")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/minecraft.jar", path & "\.minecraft.yirs\bin\minecraft.jar")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/lwjgl_util.jar", path & "\.minecraft.yirs\bin\lwjgl_util.jar")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-dx8.dll", path & "\.minecraft.yirs\bin\natives\jinput-dx8.dll")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-raw.dll", path & "\.minecraft.yirs\bin\natives\jinput-raw.dll")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/lwjgl64.dll", path & "\.minecraft.yirs\bin\natives\lwjgl64.dll")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/OpenAL32.dll", path & "\.minecraft.yirs\bin\natives\OpenAL32.dll")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-dx8_64.dll", path & "\.minecraft.yirs\bin\natives\jinput-dx8_64.dll")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-raw_64.dll", path & "\.minecraft.yirs\bin\natives\jinput-raw_64.dll")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/lwjgl.dll", path & "\.minecraft.yirs\bin\natives\lwjgl.dll")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/OpenAL64.dll", path & "\.minecraft.yirs\bin\natives\OpenAL64.dll")

ElseIf System.IO.Directory.Exists(path & "\.minecraft.yirs") = False Then
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/Minecraft.exe", path & "\.minecraft.yirs\bin\minecraft.exe")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/lwjgl.jar", path & "\.minecraft.yirs\bin\lwjgl.jar")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/version", path & "\.minecraft.yirs\bin\version")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/jinput.jar", path & "\.minecraft.yirs\bin\jinput.jar")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/minecraft.jar", path & "\.minecraft.yirs\bin\minecraft.jar")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/lwjgl_util.jar", path & "\.minecraft.yirs\bin\lwjgl_util.jar")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-dx8.dll", path & "\.minecraft.yirs\bin\natives\jinput-dx8.dll")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-raw.dll", path & "\.minecraft.yirs\bin\natives\jinput-raw.dll")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/lwjgl64.dll", path & "\.minecraft.yirs\bin\natives\lwjgl64.dll")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/OpenAL32.dll", path & "\.minecraft.yirs\bin\natives\OpenAL32.dll")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-dx8_64.dll", path & "\.minecraft.yirs\bin\natives\jinput-dx8_64.dll")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/jinput-raw_64.dll", path & "\.minecraft.yirs\bin\natives\jinput-raw_64.dll")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/lwjgl.dll", path & "\.minecraft.yirs\bin\natives\lwjgl.dll")
My.Computer.Network.DownloadFile("http://192.168.1.2/minecraft/launcher/natives/OpenAL64.dll", path & "\.minecraft.yirs\bin\natives\OpenAL64.dll")
End If
MsgBox("Mise a jour terminée", MsgBoxStyle.Information)
FormConn = 1
End Sub
0