Italian Dropbox. Da una cartella download OK e da un'altra no...

Sabotto

Active Member
Licensed User
Finalmente sono riuscito ad accedere al mio Dropbox.
Ora vorrei scaricare un file dalla mia cartella di DropBox alla cartella dell'app e scrivo:

B4X:
Dir NomeFile as string = "pippo.txt"
Dim DirDropBox as String = "\Dropbox Lavoro\Turni Telec"
Dim DirDestination As String = RP.GetSafeDirDefaultExternal("TurniTel")

'copio il file dalla cartella di DropBox alla cartella Files/Turni della mia app
dbxFiles.download(File.Combine(DirDropBox,NomeFile), DirDestination, NomeFile) ' non funziona
Non lo copia (o meglio mi crea "pippo.txt" vuoto)
Ho provato allora a creare un'altra cartella sotto DropBox Lavoro "\DropBox Lavoro\Turni Telec 2" con all'interno lo stesso file "pippo.txt"
Ripeto il comando e stavolta lo copia

B4X:
Dir NomeFile as string = "pippo.txt"
Dim DirDropBox as String = "\Dropbox Lavoro\Turni Telec 2"
Dim DirDestination As String = RP.GetSafeDirDefaultExternal("TurniTel")

'copio il file dalla cartella di DropBox alla cartella Files/Turni della mia app
dbxFiles.download(File.Combine(DirDropBox,NomeFile), DirDestination, NomeFile) ' funziona!!!

Cosa devo controllare nella cartella "Turni Telec" e in quella "Turni Telec 2" per capire dove sta la differenza fra le due?
Ho poi provato con un file PDF messo nella cartella "Turni Telec 2" e neanche lui viene copiato (viene generato un file di taglia 0)
Quindi non dipende dalla cartella
Da cosa puo dipendere?
Non capisco perchè a volte lo copia e a volte no
 
Last edited:

Sagenut

Expert
Licensed User
Longtime User
Prova così
B4X:
Dir NomeFile as string = "pippo.txt"
Dim DirDropBox as String = "\Dropbox Lavoro\Turni Telec"
Dim DirDestination As String = RP.GetSafeDirDefaultExternal("TurniTel")

'copio il file dalla cartella di DropBox alla cartella Files/Turni della mia app
dbxFiles.download(File.Combine(DirDropBox,NomeFile), DirDestination, NomeFile) ' non funziona
Wait for (dbxfiles) jobdone(dbxfiles as httpjob)
If dbxfiles.success then
   'File scaricato OK
Else
   'Qualcosa è andato storto
End if
In pratica attendi che il download sia effettivamente finito prima di proseguire.
 

DonManfred

Expert
Licensed User
Longtime User
I do not speak your language so i´ll answering in english here:
Wait for (dbxfiles) jobdone(dbxfiles as httpjob)
Dropbox JAVA Library is not using httpjobs.

For a possible solution see:

 

Sagenut

Expert
Licensed User
Longtime User
Con solo quella parte di codice ho pensato fosse un classico Httpjob. Errore mio.

With only that part of code I thought it was an Httpjob. My fault.
 

Sabotto

Active Member
Licensed User
Rispondo sia a Sagenut che a Manfred
Si Manfred io sto gia usando la versione Dropbox V2 V 0.47
Si Sagenut il problema alla fine è che il download ci mette un pochino (qualche secondo)
Potrei forse mettere un flag nell'evento
B4X:
dbxFiles_DownloadFinished
, che mi avvisa che il file è stato scaricato, ma posso fermare l'esecuzione del codice finchè il flag non è vero.? Con cosa ? Wait For?

I answer to both Sagenut and Manfred
Yes Manfred I am already using the Dropbox V2 V 0.47 version
Yes Sagenut the problem in the end is that the download takes a little bit (a few seconds)
I could perhaps put a flag in the event
B4X:
dbxFiles_DownloadFinished
,which warns me that the file has been downloaded, but I can stop the execution of the code until the flag is true.? With what ? Wait For?
 

DonManfred

Expert
Licensed User
Longtime User
which warns me that the file has been downloaded
The Event is raised when a Downloadrequest finished. Successfully or not.
It does not check if a file was downloaded before. YOU neeed to check before downloading whether the file exists and only start the download if not.
 

Sagenut

Expert
Licensed User
Longtime User
Sperando di non sbagliare di nuovo
B4X:
Wait for dbxFiles_DownloadFinished
 

Sabotto

Active Member
Licensed User
No. I want to download it regardless if it exists or not. The problem is that after I downloaded it, I have to stop the execution of the code until the file has been downloaded completely (it takes 1-2 seconds). However I solved it by looping the Size control.
About this:
B4X:
File.exists (FolderDropBox, Filename)
doesn't work with dropbox folders and files. he always tells me they don't exist
Wait For dbxFiles_DownloadFinished doesn't work well in my case
 

DonManfred

Expert
Licensed User
Longtime User
I have to stop the execution of the code until the file has been downloaded completely (it takes 1-2 seconds).
make the downloadsub a resumeable sub and use wait for to wait for the sub finished.



 
Top