[Merge] lp:~sergiusens/ciborium/mediadirs into lp:ciborium
Ricardo Salveti
rsalveti at rsalveti.net
Sun Nov 30 15:59:57 UTC 2014
Review: Needs Fixing
Diff comments:
> === modified file 'cmd/ciborium/main.go'
> --- cmd/ciborium/main.go 2014-09-24 23:02:18 +0000
> +++ cmd/ciborium/main.go 2014-11-27 01:35:16 +0000
> @@ -23,6 +23,8 @@
> "errors"
> "fmt"
> "log"
> + "os"
> + "path/filepath"
> "strings"
> "sync"
> "syscall"
> @@ -183,6 +185,11 @@
> msgStorageSuccess.Body,
> sdCardIcon,
> )
> +
> + if err := createStandardHomeDirs(m); err != nil {
> + log.Println("Failed to create standard dir layout:", err)
> + }
> +
> mw.set(mountpoint(m), true)
> }
> case e := <-blockError:
> @@ -224,6 +231,24 @@
> <-done
> }
>
> +// createStandardHomeDirs creates directories reflecting a standard home, these
> +// directories are Documents, Downloads, Music, Pictures and Videos
> +func createStandardHomeDirs(mountpoint string) error {
> + for _, node := range []string{"Documents", "Downloads", "Music", "Pictures", "Videos"} {
> + dir := filepath.Join(mountpoint, node)
> +
> + if _, err := os.Stat(dir); err != nil && os.IsNotExist(err) {
> + if err := os.MkdirAll(dir, 755); err != nil {
> + return err
> + }
> + } else {
> + return err
> + }
Run the test I said in my previous comment. If you remove one of the dirs that should be created on a clean fs, they are not going to be created anymore.
> + }
> +
> + return nil
> +}
> +
> // notify only notifies if a notification is actually needed
> // depending on freeThreshold and on warningSent's status
> func buildFreeNotify(nh *notifications.NotificationHandler) notifyFreeFunc {
>
--
https://code.launchpad.net/~sergiusens/ciborium/mediadirs/+merge/242838
Your team Ubuntu Phablet Team is subscribed to branch lp:ciborium.
More information about the Ubuntu-reviews
mailing list