diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8e71a18b..3ff702b3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ $ mc --help * If you have additional dependencies for ``mc``, ``mc`` manages its depedencies using [godep](https://github.com/tools/godep) - Run `go get foo/bar` - Edit your code to import foo/bar - - Run `make save` from top-level directory (or `godep restore && godep save ./...`). + - Run `make save` from top-level folder (or `godep restore && godep save ./...`). * When you're ready to create a pull request, be sure to: - Have test cases for the new code. If you have questions about how to do it, please ask in your pull request. diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/check.go b/Godeps/_workspace/src/gopkg.in/check.v1/check.go index ca8c0f92..c6fa0419 100644 --- a/Godeps/_workspace/src/gopkg.in/check.v1/check.go +++ b/Godeps/_workspace/src/gopkg.in/check.v1/check.go @@ -122,7 +122,7 @@ func (l *logger) String() string { } // ----------------------------------------------------------------------- -// Handling of temporary files and directories. +// Handling of temporary files and folders. type tempDir struct { sync.Mutex diff --git a/cast-main.go b/cast-main.go index b6b998f4..ca984ed6 100644 --- a/cast-main.go +++ b/cast-main.go @@ -62,7 +62,7 @@ EXAMPLES: 4. Cast a bucket from aliased Amazon S3 object storage to multiple folders on Windows. $ mc {{.Name}} s3:documents/2014/... C:\backup\2014 C:\shared\volume\backup\2014 - 5. Cast a local directory of non english character recursively to Amazon s3 object storage and Minio object storage. + 5. Cast a local folder of non english character recursively to Amazon s3 object storage and Minio object storage. $ mc {{.Name}} 本語/... s3:mylocaldocuments play:backup `, @@ -269,7 +269,7 @@ func runCastCmd(ctx *cli.Context) { session.Header.RootPath, err = os.Getwd() if err != nil { session.Close() - console.Fatalf("Unable to get current working directory. %s\n", err) + console.Fatalf("Unable to get current working folder. %s\n", err) } // extract URLs. diff --git a/cast-url.go b/cast-url.go index 1b27acbd..08bfa247 100644 --- a/cast-url.go +++ b/cast-url.go @@ -39,7 +39,6 @@ const ( castURLsTypeA castURLsTypeB castURLsTypeC - castURLsTypeD ) // NOTE: All the parse rules should reduced to A: Cast(Source, []Target). @@ -68,7 +67,7 @@ func checkCastSyntax(ctx *cli.Context) { tgtURLs := URLs[1:] /****** Generic rules *******/ - // Source cannot be a directory (except when recursive) + // Source cannot be a folder (except when recursive) if !isURLRecursive(srcURL) { _, srcContent, err := url2Stat(srcURL) // Source exist?. @@ -77,7 +76,7 @@ func checkCastSyntax(ctx *cli.Context) { } if !srcContent.Type.IsRegular() { if srcContent.Type.IsDir() { - console.Fatalf("Source ‘%s’ is a directory. Please use ‘%s...’ to recursively copy this directory and its contents.\n", srcURL, srcURL) + console.Fatalf("Source ‘%s’ is a folder. Please use ‘%s...’ to recursively copy this folder and its contents.\n", srcURL, srcURL) } console.Fatalf("Source ‘%s’ is not a regular file.\n", srcURL) } @@ -90,27 +89,82 @@ func checkCastSyntax(ctx *cli.Context) { } switch guessCastURLType(srcURL, tgtURLs) { - case castURLsTypeA: // Source is already a regular file. - // - case castURLsTypeB: // Source is already a regular file. - // - case castURLsTypeC: - srcURL = stripRecursiveURL(srcURL) - _, srcContent, err := url2Stat(srcURL) - // Source exist?. - if err != nil { - console.Fatalf("Unable to stat source ‘%s’. %s\n", srcURL, NewIodine(iodine.New(err, nil))) - } - - if srcContent.Type.IsRegular() { // Ellipses is supported only for directories. - console.Fatalf("Source ‘%s’ is not a directory. %s\n", stripRecursiveURL(srcURL), NewIodine(iodine.New(err, nil))) - } - + case castURLsTypeA: // File -> File. + checkCastSyntaxTypeA(srcURL, tgtURLs) + case castURLsTypeB: // File -> Folder. + checkCastSyntaxTypeB(srcURL, tgtURLs) + case castURLsTypeC: // Folder -> Folder. + checkCastSyntaxTypeC(srcURL, tgtURLs) default: console.Fatalln("Invalid arguments. Unable to determine how to cast. Please report this issue at https://github.com/minio/mc/issues") } } +func checkCastSyntaxTypeA(srcURL string, tgtURLs []string) { + if len(tgtURLs) == 0 && tgtURLs == nil { + console.Fatalf("Invalid number of target arguments to cast command. %s\n", NewIodine(iodine.New(errInvalidArgument{}, nil))) + } + _, srcContent, err := url2Stat(srcURL) + // Source exist?. + if err != nil { + console.Fatalf("Unable to stat source ‘%s’. %s\n", srcURL, NewIodine(iodine.New(err, nil))) + } + if srcContent.Type.IsDir() { + console.Fatalf("Source ‘%s’ is a folder. Use ‘%s...’ argument to cast this folder and its contents recursively. %s\n", srcURL, srcURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + } + if !srcContent.Type.IsRegular() { + console.Fatalf("Source ‘%s’ is not a file. %s\n", srcURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + } + for _, tgtURL := range tgtURLs { + _, tgtContent, err := url2Stat(tgtURL) + // Target exist?. + if err == nil { + if !tgtContent.Type.IsRegular() { + console.Fatalf("Target ‘%s’ is not a file. %s\n", tgtURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + } + } + } +} + +func checkCastSyntaxTypeB(srcURL string, tgtURLs []string) { + if len(tgtURLs) == 0 && tgtURLs == nil { + console.Fatalf("Invalid number of target arguments to cast command. %s\n", NewIodine(iodine.New(errInvalidArgument{}, nil))) + } + _, srcContent, err := url2Stat(srcURL) + // Source exist?. + if err != nil { + console.Fatalf("Unable to stat source ‘%s’. %s\n", srcURL, NewIodine(iodine.New(err, nil))) + } + if srcContent.Type.IsDir() { + console.Fatalf("Source ‘%s’ is a folder. Use ‘%s...’ argument to cast this folder and its contents recursively. %s\n", srcURL, srcURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + } + if !srcContent.Type.IsRegular() { + console.Fatalf("Source ‘%s’ is not a file. %s\n", srcURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + } + // targetURL can be folder or file, internally TypeB calls TypeA if it finds a file +} + +func checkCastSyntaxTypeC(srcURL string, tgtURLs []string) { + if len(tgtURLs) == 0 && tgtURLs == nil { + console.Fatalf("Invalid number of target arguments to cast command. %s\n", NewIodine(iodine.New(errInvalidArgument{}, nil))) + } + srcURL = stripRecursiveURL(srcURL) + _, srcContent, err := url2Stat(srcURL) + // Source exist?. + if err != nil { + console.Fatalf("Unable to stat source ‘%s’. %s\n", srcURL, NewIodine(iodine.New(err, nil))) + } + + if srcContent.Type.IsRegular() { // Ellipses is supported only for folders. + console.Fatalf("Source ‘%s’ is not a folder. %s\n", stripRecursiveURL(srcURL), NewIodine(iodine.New(err, nil))) + } + for _, tgtURL := range tgtURLs { + if !isTargetURLDir(tgtURL) { + console.Fatalf("One of the target ‘%s’ is not a folder. cannot have mixtures of directories and files while copying directories. %s\n", tgtURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + } + } +} + // guessCastURLType guesses the type of URL. This approach all allows prepareURL // functions to accurately report failure causes. func guessCastURLType(sourceURL string, targetURLs []string) castURLsType { @@ -190,7 +244,7 @@ func prepareSingleCastURLsTypeB(sourceURL string, targetURL string) castURLs { return prepareSingleCastURLsTypeA(sourceURL, targetURL) } - // Source is a file, target is a directory and exists. + // Source is a file, target is a folder and exists. sourceURLParse, err := client.Parse(sourceURL) if err != nil { return castURLs{Error: NewIodine(iodine.New(errInvalidSource{URL: sourceURL}, nil))} @@ -229,7 +283,7 @@ func prepareCastURLsTypeC(sourceURL string, targetURLs []string) <-chan castURLs castURLsCh <- castURLs{Error: NewIodine(iodine.New(errSourceNotRecursive{URL: sourceURL}, nil))} return } - // add `/` after trimming off `...` to emulate directories + // add `/` after trimming off `...` to emulate folders sourceURL = stripRecursiveURL(sourceURL) sourceClient, sourceContent, err := url2Stat(sourceURL) // Source exist? @@ -255,7 +309,7 @@ func prepareCastURLsTypeC(sourceURL string, targetURLs []string) <-chan castURLs // Source is not a regular file. Skip it for cast. continue } - // All OK.. We can proceed. Type B: source is a file, target is a directory and exists. + // All OK.. We can proceed. Type B: source is a file, target is a folder and exists. sourceURLParse, err := client.Parse(sourceURL) if err != nil { castURLsCh <- castURLs{Error: NewIodine(iodine.New(errInvalidSource{URL: sourceURL}, nil))} diff --git a/common-methods.go b/common-methods.go index 4d8144b1..e1601a02 100644 --- a/common-methods.go +++ b/common-methods.go @@ -29,7 +29,7 @@ import ( "github.com/minio/minio/pkg/iodine" ) -// Check if the target URL represents directory. It may or may not exist yet. +// Check if the target URL represents folder. It may or may not exist yet. func isTargetURLDir(targetURL string) bool { targetURLParse, err := client.Parse(targetURL) if err != nil { diff --git a/cp-main.go b/cp-main.go index c8fa05c8..deaf93fc 100644 --- a/cp-main.go +++ b/cp-main.go @@ -272,7 +272,7 @@ func runCopyCmd(ctx *cli.Context) { session.Header.RootPath, err = os.Getwd() if err != nil { session.Close() - console.Fatalf("Unable to get current working directory. %s\n", err) + console.Fatalf("Unable to get current working folder. %s\n", err) } // extract URLs. diff --git a/cp-url.go b/cp-url.go index 1d2ec64c..58834abd 100644 --- a/cp-url.go +++ b/cp-url.go @@ -81,11 +81,11 @@ func checkCopySyntax(ctx *cli.Context) { switch guessCopyURLType(srcURLs, tgtURL) { case copyURLsTypeA: // File -> File. checkCopySyntaxTypeA(srcURLs, tgtURL) - case copyURLsTypeB: // File -> Directory. + case copyURLsTypeB: // File -> Folder. checkCopySyntaxTypeB(srcURLs, tgtURL) - case copyURLsTypeC: // Directory... -> Directory. + case copyURLsTypeC: // Folder... -> Folder. checkCopySyntaxTypeC(srcURLs, tgtURL) - case copyURLsTypeD: // File | Directory... -> Directory. + case copyURLsTypeD: // File | Folder... -> Folder. checkCopySyntaxTypeD(srcURLs, tgtURL) default: console.Fatalln("Invalid arguments. Unable to determine how to copy. Please report this issue at https://github.com/minio/mc/issues") @@ -103,17 +103,19 @@ func checkCopySyntaxTypeA(srcURLs []string, tgtURL string) { if err != nil { console.Fatalf("Unable to stat source ‘%s’. %s\n", srcURL, NewIodine(iodine.New(err, nil))) } + if srcContent.Type.IsDir() { + console.Fatalf("Source ‘%s’ is a folder. Use ‘%s...’ argument to copy this folder and its contents recursively. %s\n", srcURL, srcURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + } if !srcContent.Type.IsRegular() { console.Fatalf("Source ‘%s’ is not a file. %s\n", srcURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) } _, tgtContent, err := url2Stat(tgtURL) // Target exist?. - if err != nil { - console.Fatalf("Unable to stat target ‘%s’. %s\n", tgtURL, NewIodine(iodine.New(err, nil))) - } - if !tgtContent.Type.IsRegular() { - console.Fatalf("Target ‘%s’ is not a file. %s\n", tgtURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + if err == nil { + if !tgtContent.Type.IsRegular() { + console.Fatalf("Target ‘%s’ is not a file. %s\n", tgtURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + } } } @@ -129,7 +131,7 @@ func checkCopySyntaxTypeB(srcURLs []string, tgtURL string) { console.Fatalf("Unable to stat source ‘%s’. %s\n", srcURL, NewIodine(iodine.New(err, nil))) } if srcContent.Type.IsDir() { - console.Fatalf("Source ‘%s’ is a directory. Use ‘%s...’ argument to copy this directory and its contents recursively. %s\n", srcURL, srcURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + console.Fatalf("Source ‘%s’ is a folder. Use ‘%s...’ argument to copy this folder and its contents recursively. %s\n", srcURL, srcURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) } if !srcContent.Type.IsRegular() { console.Fatalf("Source ‘%s’ is not a file. %s\n", srcURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) @@ -137,11 +139,10 @@ func checkCopySyntaxTypeB(srcURLs []string, tgtURL string) { _, tgtContent, err := url2Stat(tgtURL) // Target exist?. - if err != nil { - console.Fatalf("Unable to stat target ‘%s’. %s\n", tgtURL, NewIodine(iodine.New(err, nil))) - } - if !tgtContent.Type.IsDir() { - console.Fatalf("Target ‘%s’ is not a directory. %s\n", tgtURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + if err == nil { + if !tgtContent.Type.IsDir() { + console.Fatalf("Target ‘%s’ is not a folder. %s\n", tgtURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + } } } @@ -157,8 +158,8 @@ func checkCopySyntaxTypeC(srcURLs []string, tgtURL string) { if err != nil { console.Fatalf("Unable to stat source ‘%s’. %s\n", srcURL, NewIodine(iodine.New(err, nil))) } - if srcContent.Type.IsRegular() { // Ellipses is supported only for directories. - console.Fatalf("Source ‘%s’ is not a directory. %s\n", stripRecursiveURL(srcURL), NewIodine(iodine.New(errInvalidArgument{}, nil))) + if srcContent.Type.IsRegular() { // Ellipses is supported only for folders. + console.Fatalf("Source ‘%s’ is not a folder. %s\n", stripRecursiveURL(srcURL), NewIodine(iodine.New(errInvalidArgument{}, nil))) } _, tgtContent, err := url2Stat(tgtURL) @@ -167,7 +168,7 @@ func checkCopySyntaxTypeC(srcURLs []string, tgtURL string) { console.Fatalf("Unable to stat target ‘%s’. %s\n", tgtURL, NewIodine(iodine.New(err, nil))) } if !tgtContent.Type.IsDir() { - console.Fatalf("Target ‘%s’ is not a directory. %s\n", tgtURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + console.Fatalf("Target ‘%s’ is not a folder. %s\n", tgtURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) } } @@ -181,8 +182,8 @@ func checkCopySyntaxTypeD(srcURLs []string, tgtURL string) { if err != nil { console.Fatalf("Unable to stat source ‘%s’. %s\n", srcURL, NewIodine(iodine.New(err, nil))) } - if !srcContent.Type.IsDir() { // Ellipses is supported only for directories. - console.Fatalf("Source ‘%s’ is not a directory. %s\n", stripRecursiveURL(srcURL), NewIodine(iodine.New(errInvalidArgument{}, nil))) + if !srcContent.Type.IsDir() { // Ellipses is supported only for folders. + console.Fatalf("Source ‘%s’ is not a folder. %s\n", stripRecursiveURL(srcURL), NewIodine(iodine.New(errInvalidArgument{}, nil))) } } else { // Regular URL. _, srcContent, err := url2Stat(srcURL) @@ -191,7 +192,7 @@ func checkCopySyntaxTypeD(srcURLs []string, tgtURL string) { console.Fatalf("Unable to stat source ‘%s’. %s\n", srcURL, NewIodine(iodine.New(err, nil))) } if srcContent.Type.IsDir() { - console.Fatalf("Source ‘%s’ is a directory. Use ‘%s...’ argument to copy this directory and its contents recursively. %s\n", srcURL, srcURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + console.Fatalf("Source ‘%s’ is a folder. Use ‘%s...’ argument to copy this folder and its contents recursively. %s\n", srcURL, srcURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) } if !srcContent.Type.IsRegular() { console.Fatalf("Source ‘%s’ is not a file. %s\n", srcURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) @@ -204,7 +205,7 @@ func checkCopySyntaxTypeD(srcURLs []string, tgtURL string) { console.Fatalf("Unable to stat target ‘%s’. %s\n", tgtURL, NewIodine(iodine.New(err, nil))) } if !tgtContent.Type.IsDir() { - console.Fatalf("Target ‘%s’ is not a directory. %s\n", tgtURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + console.Fatalf("Target ‘%s’ is not a folder. %s\n", tgtURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) } } @@ -217,6 +218,11 @@ func guessCopyURLType(sourceURLs []string, targetURL string) copyURLsType { if sourceURLs == nil { // Source list is empty return copyURLsTypeInvalid } + for _, sourceURL := range sourceURLs { + if sourceURL == "" { // One of the source is empty + return copyURLsTypeInvalid + } + } if len(sourceURLs) == 1 { // 1 Source, 1 Target switch { // Type C @@ -263,7 +269,7 @@ func prepareCopyURLsTypeB(sourceURL string, targetURL string) copyURLs { return copyURLs{Error: NewIodine(iodine.New(errInvalidSource{URL: sourceURL}, nil))} } - // All OK.. We can proceed. Type B: source is a file, target is a directory and exists. + // All OK.. We can proceed. Type B: source is a file, target is a folder and exists. sourceURLParse, err := client.Parse(sourceURL) if err != nil { return copyURLs{Error: NewIodine(iodine.New(errInvalidSource{URL: sourceURL}, nil))} @@ -290,7 +296,7 @@ func prepareCopyURLsTypeC(sourceURL, targetURL string) <-chan copyURLs { return } - // add `/` after trimming off `...` to emulate directories + // add `/` after trimming off `...` to emulate folders sourceURL = stripRecursiveURL(sourceURL) sourceClient, sourceContent, err := url2Stat(sourceURL) if err != nil { @@ -317,7 +323,7 @@ func prepareCopyURLsTypeC(sourceURL, targetURL string) <-chan copyURLs { continue } - // All OK.. We can proceed. Type B: source is a file, target is a directory and exists. + // All OK.. We can proceed. Type B: source is a file, target is a folder and exists. sourceURLParse, err := client.Parse(sourceURL) if err != nil { copyURLsCh <- copyURLs{Error: NewIodine(iodine.New(errInvalidSource{URL: sourceURL}, nil))} @@ -363,7 +369,7 @@ func prepareCopyURLsTypeD(sourceURLs []string, targetURL string) <-chan copyURLs } for _, sourceURL := range sourceURLs { - // Target is directory. Possibilities are only Type B and C + // Target is folder. Possibilities are only Type B and C // Is it a recursive URL "..."? if isURLRecursive(sourceURL) { for cURLs := range prepareCopyURLsTypeC(sourceURL, targetURL) { diff --git a/diff-main.go b/diff-main.go index 6ed063ab..488bd734 100644 --- a/diff-main.go +++ b/diff-main.go @@ -45,7 +45,7 @@ EXAMPLES: 1. Compare foo.ogg on a local filesystem with bar.ogg on Amazon AWS cloud storage. $ mc {{.Name}} foo.ogg https://s3.amazonaws.com/jukebox/bar.ogg - 2. Compare two different directories on a local filesystem. + 2. Compare two different folders on a local filesystem. $ mc {{.Name}} ~/Photos /Media/Backup/Photos `, diff --git a/docs/mb.md b/docs/mb.md index 21c7b8ff..2414d8a8 100644 --- a/docs/mb.md +++ b/docs/mb.md @@ -11,7 +11,7 @@ EXAMPLES: 1. Create a bucket on Amazon S3 object storage. $ mc mb https://s3.amazonaws.com/public-document-store - 3. Make a directory on local filesystem, including its parent directories as needed. + 3. Make a folder on local filesystem, including its parent folders as needed. $ mc mb ~/ 3. Create a bucket on Minio object storage. diff --git a/errors.go b/errors.go index 5b64fd25..1f46cc68 100644 --- a/errors.go +++ b/errors.go @@ -140,13 +140,13 @@ func (e errInvalidTheme) Error() string { type errTargetIsNotDir errInvalidURL func (e errTargetIsNotDir) Error() string { - return "Target ‘" + e.URL + "’ is not a directory." + return "Target ‘" + e.URL + "’ is not a folder." } type errTargetNotFound errInvalidURL func (e errTargetNotFound) Error() string { - return "Target directory ‘" + e.URL + "’ does not exist." + return "Target folder ‘" + e.URL + "’ does not exist." } type errSourceNotRecursive errInvalidURL @@ -158,7 +158,7 @@ func (e errSourceNotRecursive) Error() string { type errSourceIsNotDir errTargetIsNotDir func (e errSourceIsNotDir) Error() string { - return "Source ‘" + e.URL + "’ is not a directory." + return "Source ‘" + e.URL + "’ is not a folder." } type errSourceListEmpty errInvalidArgument diff --git a/flags.go b/flags.go index ee65f220..377f7026 100644 --- a/flags.go +++ b/flags.go @@ -34,7 +34,7 @@ var ( configFlag = cli.StringFlag{ Name: "config, C", Value: mustGetMcConfigDir(), - Usage: "Path to configuration directory", + Usage: "Path to configuration folder", } quietFlag = cli.BoolFlag{ diff --git a/ls.go b/ls.go index 072d119b..c09f84ae 100644 --- a/ls.go +++ b/ls.go @@ -42,7 +42,7 @@ func parseContent(c *client.Content) Content { // guess file type content.Filetype = func() string { if c.Type.IsDir() { - return "directory" + return "folder" } return "file" }() diff --git a/main.go b/main.go index fc4dfbbd..4d98059e 100644 --- a/main.go +++ b/main.go @@ -37,7 +37,7 @@ func checkConfig() { if !isSessionDirExists() { if err := createSessionDir(); err != nil { - console.Fatalf("Unable to create session directory. %s\n", err) + console.Fatalf("Unable to create session folder. %s\n", err) } } diff --git a/mb-main.go b/mb-main.go index 59c3db20..6ba97f86 100644 --- a/mb-main.go +++ b/mb-main.go @@ -47,7 +47,7 @@ EXAMPLES: 1. Create a bucket on Amazon S3 object storage. $ mc {{.Name}} https://s3.amazonaws.com/public-document-store - 3. Make a directory on local filesystem, including its parent directories as needed. + 3. Make a folder on local filesystem, including its parent folders as needed. $ mc {{.Name}} ~/ 3. Create a bucket on Minio object storage. diff --git a/pkg/client/fs/fs_test.go b/pkg/client/fs/fs_test.go index bd6562ca..5d71a219 100644 --- a/pkg/client/fs/fs_test.go +++ b/pkg/client/fs/fs_test.go @@ -107,18 +107,18 @@ func (s *MySuite) TestList(c *C) { c.Assert(len(contents), Equals, 4) var regularFiles int - var directories int + var folders int for _, content := range contents { if content.Type.IsRegular() { regularFiles++ continue } if content.Type.IsDir() { - directories++ + folders++ } } c.Assert(regularFiles, Equals, 3) - c.Assert(directories, Equals, 1) + c.Assert(folders, Equals, 1) } func (s *MySuite) TestPutBucket(c *C) { diff --git a/print-structs.go b/print-structs.go index 2fdebba4..21eef4a4 100644 --- a/print-structs.go +++ b/print-structs.go @@ -70,7 +70,7 @@ func (c Content) String() string { message := console.Time("[%s] ", c.Time) message = message + console.Size("%6s ", c.Size) message = func() string { - if c.Filetype == "directory" { + if c.Filetype == "folder" { return message + console.Dir("%s", c.Name) } return message + console.File("%s", c.Name) diff --git a/session-main.go b/session-main.go index 73c7e505..9a0521f8 100644 --- a/session-main.go +++ b/session-main.go @@ -122,7 +122,7 @@ func runSessionCmd(ctx *cli.Context) { } if !isSessionDirExists() { if err := createSessionDir(); err != nil { - console.Fatalf("Unable to create session directory. %s\n", err) + console.Fatalf("Unable to create session folder. %s\n", err) } } switch strings.TrimSpace(ctx.Args().First()) { @@ -154,7 +154,7 @@ func runSessionCmd(ctx *cli.Context) { savedCwd, err := os.Getwd() if err != nil { - console.Fatalln("Unable to verify your current working directory. %s\n", err) + console.Fatalln("Unable to verify your current working folder. %s\n", err) } if s.Header.RootPath != "" { // chdir to RootPath diff --git a/session-v1.go b/session-v1.go index 43b9b120..e70d9f6e 100644 --- a/session-v1.go +++ b/session-v1.go @@ -78,7 +78,7 @@ func loadSessionV1(sid string) (*sessionV1, error) { func getSessionIDsV1() (sids []string) { sessionList, err := filepath.Glob(getSessionDir() + "/*") if err != nil { - console.Fatalf("Unable to list session directory ‘%s’, %s", getSessionDir(), NewIodine(iodine.New(err, nil))) + console.Fatalf("Unable to list session folder ‘%s’, %s", getSessionDir(), NewIodine(iodine.New(err, nil))) } for _, path := range sessionList { diff --git a/session-v2.go b/session-v2.go index 66611b8d..7de005da 100644 --- a/session-v2.go +++ b/session-v2.go @@ -43,7 +43,7 @@ func migrateSessionV1ToV2() { type sessionV2Header struct { Version string `json:"version"` When time.Time `json:"time"` - RootPath string `json:"working-directory"` + RootPath string `json:"working-folder"` CommandType string `json:"command-type"` CommandArgs []string `json:"cmd-args"` LastCopied string `json:"last-copied"` diff --git a/session.go b/session.go index 8adff752..b4f18d2b 100644 --- a/session.go +++ b/session.go @@ -78,7 +78,7 @@ func getSessionDataFile(sid string) string { func getSessionIDs() (sids []string) { sessionList, err := filepath.Glob(getSessionDir() + "/*.json") if err != nil { - console.Fatalf("Unable to list session directory ‘%s’, %s", getSessionDir(), NewIodine(iodine.New(err, nil))) + console.Fatalf("Unable to list session folder ‘%s’, %s", getSessionDir(), NewIodine(iodine.New(err, nil))) } for _, path := range sessionList {