2016-05-27 08:35:55 -07:00
|
|
|
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
|
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
|
|
|
|
package utils
|
|
|
|
|
|
2016-07-20 17:01:10 -04:00
|
|
|
import (
|
|
|
|
|
"os"
|
|
|
|
|
)
|
|
|
|
|
|
2016-05-27 08:35:55 -07:00
|
|
|
func StringArrayIntersection(arr1, arr2 []string) []string {
|
|
|
|
|
arrMap := map[string]bool{}
|
|
|
|
|
result := []string{}
|
|
|
|
|
|
|
|
|
|
for _, value := range arr1 {
|
|
|
|
|
arrMap[value] = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, value := range arr2 {
|
|
|
|
|
if arrMap[value] {
|
|
|
|
|
result = append(result, value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
}
|
2016-07-20 17:01:10 -04:00
|
|
|
|
|
|
|
|
func FileExistsInConfigFolder(filename string) bool {
|
|
|
|
|
if len(filename) == 0 {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if _, err := os.Stat(FindConfigFile(filename)); err == nil {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
}
|