sync: Export DownloadExerciceFile function
This commit is contained in:
parent
f3cdf1afca
commit
c3353572e6
3 changed files with 11 additions and 11 deletions
|
@ -180,10 +180,10 @@ func GetFileContent(i Importer, URI string) (string, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// getDestinationFilePath generates the destination path, from the URI.
|
||||
// GetDestinationFilePath generates the destination path, from the URI.
|
||||
// This function permits to obfusce to player the original URI.
|
||||
// Theoricaly, changing the import method doesn't change destination URI.
|
||||
func getDestinationFilePath(URI string, filename *string) string {
|
||||
func GetDestinationFilePath(URI string, filename *string) string {
|
||||
if filename == nil {
|
||||
tmp := path.Base(URI)
|
||||
filename = &tmp
|
||||
|
@ -218,7 +218,7 @@ func importFile(i Importer, URI string, dest string) error {
|
|||
// ImportFile imports the file at the given URI, using helpers of the given Importer.
|
||||
// After import, next is called with relative path where the file has been saved and the original URI.
|
||||
func ImportFile(i Importer, URI string, next func(string, string) (interface{}, error)) (interface{}, error) {
|
||||
dest := getDestinationFilePath(URI, nil)
|
||||
dest := GetDestinationFilePath(URI, nil)
|
||||
|
||||
// If the present file is still valide, don't erase it
|
||||
if _, err := os.Stat(dest); !os.IsNotExist(err) {
|
||||
|
|
Reference in a new issue