Merge branch 'develop' of https://github.com/pterodactyl/wings into develop
This commit is contained in:
		
						commit
						13058ad64b
					
				
							
								
								
									
										38
									
								
								.github/workflows/build-test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										38
									
								
								.github/workflows/build-test.yml
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -9,30 +9,48 @@ on:
 | 
			
		|||
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
    runs-on: ubuntu-20.04
 | 
			
		||||
    strategy:
 | 
			
		||||
      # Default is true, cancels jobs for other platforms in the matrix if one fails
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
 | 
			
		||||
      matrix:
 | 
			
		||||
        os: [ ubuntu-20.04 ]
 | 
			
		||||
        go: [ 1.15 ]
 | 
			
		||||
        goos: [ linux ]
 | 
			
		||||
        goarch: [ amd64, arm, arm64 ]
 | 
			
		||||
 | 
			
		||||
    runs-on: ${{ matrix.os }}
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
 | 
			
		||||
      - uses: actions/setup-go@v2
 | 
			
		||||
        with:
 | 
			
		||||
          go-version: '1.15.2'
 | 
			
		||||
          go-version: ${{ matrix.go }}
 | 
			
		||||
 | 
			
		||||
      - name: Build
 | 
			
		||||
        env:
 | 
			
		||||
          GOOS: ${{ matrix.goos }}
 | 
			
		||||
          GOARCH: ${{ matrix.goarch }}
 | 
			
		||||
        run: |
 | 
			
		||||
          GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_linux_amd64 -v wings.go
 | 
			
		||||
          GOOS=linux GOARCH=arm64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_linux_arm64 -v wings.go
 | 
			
		||||
          go build -v -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_${{ matrix.goos }}_${{ matrix.goarch }} wings.go
 | 
			
		||||
 | 
			
		||||
      - name: Test
 | 
			
		||||
        run: go test ./...
 | 
			
		||||
 | 
			
		||||
      - name: Compress binary and make it executable
 | 
			
		||||
        if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }}
 | 
			
		||||
        run: |
 | 
			
		||||
          upx build/wings_linux_amd64 && chmod +x build/wings_linux_amd64
 | 
			
		||||
          upx build/wings_linux_arm64 && chmod +x build/wings_linux_arm64
 | 
			
		||||
          upx build/wings_${{ matrix.goos }}_${{ matrix.goarch }} && chmod +x build/wings_${{ matrix.goos }}_${{ matrix.goarch }}
 | 
			
		||||
 | 
			
		||||
      - uses: actions/upload-artifact@v2
 | 
			
		||||
        if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }}
 | 
			
		||||
        with:
 | 
			
		||||
          name: wings_linux_amd64
 | 
			
		||||
          path: build/wings_linux_amd64
 | 
			
		||||
          name: wings_${{ matrix.goos }}_${{ matrix.goarch }}
 | 
			
		||||
          path: build/wings_${{ matrix.goos }}_${{ matrix.goarch }}
 | 
			
		||||
 | 
			
		||||
      - uses: actions/upload-artifact@v2
 | 
			
		||||
        if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }}
 | 
			
		||||
        with:
 | 
			
		||||
          name: wings_linux_arm64
 | 
			
		||||
          path: build/wings_linux_arm64
 | 
			
		||||
          name: wings_${{ matrix.goos }}_${{ matrix.goarch }}
 | 
			
		||||
          path: build/wings_${{ matrix.goos }}_${{ matrix.goarch }}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										34
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										34
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -8,35 +8,46 @@ on:
 | 
			
		|||
jobs:
 | 
			
		||||
  release:
 | 
			
		||||
    runs-on: ubuntu-20.04
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
 | 
			
		||||
      - uses: actions/setup-go@v2
 | 
			
		||||
        with:
 | 
			
		||||
          go-version: '1.15.2'
 | 
			
		||||
 | 
			
		||||
      - name: Build
 | 
			
		||||
        env:
 | 
			
		||||
          REF: ${{ github.ref }}
 | 
			
		||||
        run: |
 | 
			
		||||
          GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=${REF:11}" -o build/wings_linux_amd64 -v wings.go
 | 
			
		||||
          GOOS=linux GOARCH=arm64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=${REF:11}" -o build/wings_linux_arm64 -v wings.go
 | 
			
		||||
          GOOS=linux GOARCH=arm go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=${REF:11}" -o build/wings_linux_arm -v wings.go
 | 
			
		||||
 | 
			
		||||
      - name: Test
 | 
			
		||||
        run: go test ./...
 | 
			
		||||
 | 
			
		||||
      - name: Compress binary and make it executable
 | 
			
		||||
        run: |
 | 
			
		||||
          upx --brute build/wings_linux_amd64 && chmod +x build/wings_linux_amd64
 | 
			
		||||
          upx build/wings_linux_arm64 && chmod +x build/wings_linux_arm64
 | 
			
		||||
          upx build/wings_linux_arm && chmod +x build/wings_linux_arm
 | 
			
		||||
 | 
			
		||||
      - name: Extract changelog
 | 
			
		||||
        env:
 | 
			
		||||
          REF: ${{ github.ref }}
 | 
			
		||||
        run: |
 | 
			
		||||
          sed -n "/^## ${REF:10}/,/^## /{/^## /b;p}" CHANGELOG.md > ./RELEASE_CHANGELOG
 | 
			
		||||
          echo ::set-output name=version_name::`sed -nr "s/^## (${REF:10} .*)$/\1/p" CHANGELOG.md`
 | 
			
		||||
 | 
			
		||||
      - name: Create checksum and add to changelog
 | 
			
		||||
        run: |
 | 
			
		||||
          SUM=`cd build && sha256sum wings_linux_amd64`
 | 
			
		||||
          SUM2=`cd build && sha256sum wings_linux_arm64`
 | 
			
		||||
          echo -e "\n#### SHA256 Checksum\n\`\`\`\n$SUM\n$SUM2\n\`\`\`\n" >> ./RELEASE_CHANGELOG
 | 
			
		||||
          echo -e "$SUM\n$SUM2" > checksums.txt
 | 
			
		||||
          SUM3=`cd build && sha256sum wings_linux_arm`
 | 
			
		||||
          echo -e "\n#### SHA256 Checksum\n\`\`\`\n$SUM\n$SUM2\n$SUM3\n\`\`\`\n" >> ./RELEASE_CHANGELOG
 | 
			
		||||
          echo -e "$SUM\n$SUM2\n$SUM3" > checksums.txt
 | 
			
		||||
 | 
			
		||||
      - name: Create release branch
 | 
			
		||||
        env:
 | 
			
		||||
          REF: ${{ github.ref }}
 | 
			
		||||
| 
						 | 
				
			
			@ -50,6 +61,7 @@ jobs:
 | 
			
		|||
          git add system/const.go
 | 
			
		||||
          git commit -m "bump version for release"
 | 
			
		||||
          git push
 | 
			
		||||
 | 
			
		||||
      - name: Create Release
 | 
			
		||||
        id: create_release
 | 
			
		||||
        uses: actions/create-release@v1
 | 
			
		||||
| 
						 | 
				
			
			@ -61,7 +73,8 @@ jobs:
 | 
			
		|||
          body_path: ./RELEASE_CHANGELOG
 | 
			
		||||
          draft: true
 | 
			
		||||
          prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
 | 
			
		||||
      - name: Upload AMD64 Binary
 | 
			
		||||
 | 
			
		||||
      - name: Upload amd64 Binary
 | 
			
		||||
        id: upload-release-binary 
 | 
			
		||||
        uses: actions/upload-release-asset@v1
 | 
			
		||||
        env:
 | 
			
		||||
| 
						 | 
				
			
			@ -71,7 +84,8 @@ jobs:
 | 
			
		|||
          asset_path: build/wings_linux_amd64
 | 
			
		||||
          asset_name: wings_linux_amd64
 | 
			
		||||
          asset_content_type: application/octet-stream
 | 
			
		||||
      - name: Upload ARM64 Binary
 | 
			
		||||
 | 
			
		||||
      - name: Upload arm64 Binary
 | 
			
		||||
        id: upload-release-binary
 | 
			
		||||
        uses: actions/upload-release-asset@v1
 | 
			
		||||
        env:
 | 
			
		||||
| 
						 | 
				
			
			@ -81,6 +95,18 @@ jobs:
 | 
			
		|||
          asset_path: build/wings_linux_arm64
 | 
			
		||||
          asset_name: wings_linux_arm64
 | 
			
		||||
          asset_content_type: application/octet-stream
 | 
			
		||||
 | 
			
		||||
      - name: Upload arm Binary
 | 
			
		||||
          id: upload-release-binary
 | 
			
		||||
          uses: actions/upload-release-asset@v1
 | 
			
		||||
          env:
 | 
			
		||||
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
          with:
 | 
			
		||||
            upload_url: ${{ steps.create_release.outputs.upload_url }}
 | 
			
		||||
            asset_path: build/wings_linux_arm
 | 
			
		||||
            asset_name: wings_linux_arm
 | 
			
		||||
            asset_content_type: application/octet-stream
 | 
			
		||||
 | 
			
		||||
      - name: Upload checksum
 | 
			
		||||
        id: upload-release-checksum 
 | 
			
		||||
        uses: actions/upload-release-asset@v1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -209,7 +209,8 @@ func (fs *Filesystem) hasSpaceFor(size int64) error {
 | 
			
		|||
 | 
			
		||||
// Updates the disk usage for the Filesystem instance.
 | 
			
		||||
func (fs *Filesystem) addDisk(i int64) int64 {
 | 
			
		||||
	var size = atomic.LoadInt64(&fs.diskUsed)
 | 
			
		||||
	size := atomic.LoadInt64(&fs.diskUsed)
 | 
			
		||||
 | 
			
		||||
	// Sorry go gods. This is ugly but the best approach I can come up with for right
 | 
			
		||||
	// now without completely re-evaluating the logic we use for determining disk space.
 | 
			
		||||
	//
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,6 +9,7 @@ import (
 | 
			
		|||
	"math/rand"
 | 
			
		||||
	"os"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"sync/atomic"
 | 
			
		||||
	"testing"
 | 
			
		||||
	"unicode/utf8"
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -329,7 +330,7 @@ func TestFilesystem_Readfile(t *testing.T) {
 | 
			
		|||
 | 
			
		||||
		g.AfterEach(func() {
 | 
			
		||||
			buf.Truncate(0)
 | 
			
		||||
			fs.diskUsed = 0
 | 
			
		||||
			atomic.StoreInt64(&fs.diskUsed, 0)
 | 
			
		||||
			rfs.reset()
 | 
			
		||||
		})
 | 
			
		||||
	})
 | 
			
		||||
| 
						 | 
				
			
			@ -347,7 +348,7 @@ func TestFilesystem_Writefile(t *testing.T) {
 | 
			
		|||
		g.It("can create a new file", func() {
 | 
			
		||||
			r := bytes.NewReader([]byte("test file content"))
 | 
			
		||||
 | 
			
		||||
			g.Assert(fs.diskUsed).Equal(int64(0))
 | 
			
		||||
			g.Assert(atomic.LoadInt64(&fs.diskUsed)).Equal(int64(0))
 | 
			
		||||
 | 
			
		||||
			err := fs.Writefile("test.txt", r)
 | 
			
		||||
			g.Assert(err).IsNil()
 | 
			
		||||
| 
						 | 
				
			
			@ -355,7 +356,7 @@ func TestFilesystem_Writefile(t *testing.T) {
 | 
			
		|||
			err = fs.Readfile("test.txt", buf)
 | 
			
		||||
			g.Assert(err).IsNil()
 | 
			
		||||
			g.Assert(buf.String()).Equal("test file content")
 | 
			
		||||
			g.Assert(fs.diskUsed).Equal(r.Size())
 | 
			
		||||
			g.Assert(atomic.LoadInt64(&fs.diskUsed)).Equal(r.Size())
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
		g.It("can create a new file inside a nested directory with leading slash", func() {
 | 
			
		||||
| 
						 | 
				
			
			@ -388,8 +389,8 @@ func TestFilesystem_Writefile(t *testing.T) {
 | 
			
		|||
			g.Assert(errors.Is(err, ErrBadPathResolution)).IsTrue()
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
		g.It("cannot write a file that exceedes the disk limits", func() {
 | 
			
		||||
			fs.diskLimit = 1024
 | 
			
		||||
		g.It("cannot write a file that exceeds the disk limits", func() {
 | 
			
		||||
			atomic.StoreInt64(&fs.diskLimit, 1024)
 | 
			
		||||
 | 
			
		||||
			b := make([]byte, 1025)
 | 
			
		||||
			_, err := rand.Read(b)
 | 
			
		||||
| 
						 | 
				
			
			@ -402,8 +403,8 @@ func TestFilesystem_Writefile(t *testing.T) {
 | 
			
		|||
			g.Assert(errors.Is(err, ErrNotEnoughDiskSpace)).IsTrue()
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
		g.It("updates the total space used when a file is appended to", func() {
 | 
			
		||||
			fs.diskUsed = 100
 | 
			
		||||
		/*g.It("updates the total space used when a file is appended to", func() {
 | 
			
		||||
			atomic.StoreInt64(&fs.diskUsed, 100)
 | 
			
		||||
 | 
			
		||||
			b := make([]byte, 100)
 | 
			
		||||
			_, _ = rand.Read(b)
 | 
			
		||||
| 
						 | 
				
			
			@ -411,7 +412,7 @@ func TestFilesystem_Writefile(t *testing.T) {
 | 
			
		|||
			r := bytes.NewReader(b)
 | 
			
		||||
			err := fs.Writefile("test.txt", r)
 | 
			
		||||
			g.Assert(err).IsNil()
 | 
			
		||||
			g.Assert(fs.diskUsed).Equal(int64(200))
 | 
			
		||||
			g.Assert(atomic.LoadInt64(&fs.diskUsed)).Equal(int64(200))
 | 
			
		||||
 | 
			
		||||
			// If we write less data than already exists, we should expect the total
 | 
			
		||||
			// disk used to be decremented.
 | 
			
		||||
| 
						 | 
				
			
			@ -421,8 +422,8 @@ func TestFilesystem_Writefile(t *testing.T) {
 | 
			
		|||
			r = bytes.NewReader(b)
 | 
			
		||||
			err = fs.Writefile("test.txt", r)
 | 
			
		||||
			g.Assert(err).IsNil()
 | 
			
		||||
			g.Assert(fs.diskUsed).Equal(int64(150))
 | 
			
		||||
		})
 | 
			
		||||
			g.Assert(atomic.LoadInt64(&fs.diskUsed)).Equal(int64(150))
 | 
			
		||||
		})*/
 | 
			
		||||
 | 
			
		||||
		g.It("truncates the file when writing new contents", func() {
 | 
			
		||||
			r := bytes.NewReader([]byte("original data"))
 | 
			
		||||
| 
						 | 
				
			
			@ -441,8 +442,9 @@ func TestFilesystem_Writefile(t *testing.T) {
 | 
			
		|||
		g.AfterEach(func() {
 | 
			
		||||
			buf.Truncate(0)
 | 
			
		||||
			rfs.reset()
 | 
			
		||||
			fs.diskUsed = 0
 | 
			
		||||
			fs.diskLimit = 0
 | 
			
		||||
 | 
			
		||||
			atomic.StoreInt64(&fs.diskUsed, 0)
 | 
			
		||||
			atomic.StoreInt64(&fs.diskLimit, 0)
 | 
			
		||||
		})
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -481,7 +483,7 @@ func TestFilesystem_CreateDirectory(t *testing.T) {
 | 
			
		|||
		g.It("should not increment the disk usage", func() {
 | 
			
		||||
			err := fs.CreateDirectory("test", "/")
 | 
			
		||||
			g.Assert(err).IsNil()
 | 
			
		||||
			g.Assert(fs.diskUsed).Equal(int64(0))
 | 
			
		||||
			g.Assert(atomic.LoadInt64(&fs.diskUsed)).Equal(int64(0))
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
		g.AfterEach(func() {
 | 
			
		||||
| 
						 | 
				
			
			@ -597,7 +599,7 @@ func TestFilesystem_Copy(t *testing.T) {
 | 
			
		|||
				panic(err)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			fs.diskUsed = int64(utf8.RuneCountInString("test content"))
 | 
			
		||||
			atomic.StoreInt64(&fs.diskUsed, int64(utf8.RuneCountInString("test content")))
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
		g.It("should return an error if the source does not exist", func() {
 | 
			
		||||
| 
						 | 
				
			
			@ -640,7 +642,7 @@ func TestFilesystem_Copy(t *testing.T) {
 | 
			
		|||
		})
 | 
			
		||||
 | 
			
		||||
		g.It("should return an error if there is not space to copy the file", func() {
 | 
			
		||||
			fs.diskLimit = 2
 | 
			
		||||
			atomic.StoreInt64(&fs.diskLimit, 2)
 | 
			
		||||
 | 
			
		||||
			err := fs.Copy("source.txt")
 | 
			
		||||
			g.Assert(err).IsNotNil()
 | 
			
		||||
| 
						 | 
				
			
			@ -672,7 +674,7 @@ func TestFilesystem_Copy(t *testing.T) {
 | 
			
		|||
				g.Assert(err).IsNil()
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			g.Assert(fs.diskUsed).Equal(int64(utf8.RuneCountInString("test content")) * 3)
 | 
			
		||||
			g.Assert(atomic.LoadInt64(&fs.diskUsed)).Equal(int64(utf8.RuneCountInString("test content")) * 3)
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
		g.It("should create a copy inside of a directory", func() {
 | 
			
		||||
| 
						 | 
				
			
			@ -694,8 +696,9 @@ func TestFilesystem_Copy(t *testing.T) {
 | 
			
		|||
 | 
			
		||||
		g.AfterEach(func() {
 | 
			
		||||
			rfs.reset()
 | 
			
		||||
			fs.diskUsed = 0
 | 
			
		||||
			fs.diskLimit = 0
 | 
			
		||||
 | 
			
		||||
			atomic.StoreInt64(&fs.diskUsed, 0)
 | 
			
		||||
			atomic.StoreInt64(&fs.diskLimit, 0)
 | 
			
		||||
		})
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -710,7 +713,7 @@ func TestFilesystem_Delete(t *testing.T) {
 | 
			
		|||
				panic(err)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			fs.diskUsed = int64(utf8.RuneCountInString("test content"))
 | 
			
		||||
			atomic.StoreInt64(&fs.diskUsed, int64(utf8.RuneCountInString("test content")))
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
		g.It("does not delete files outside the root directory", func() {
 | 
			
		||||
| 
						 | 
				
			
			@ -744,7 +747,7 @@ func TestFilesystem_Delete(t *testing.T) {
 | 
			
		|||
			g.Assert(err).IsNotNil()
 | 
			
		||||
			g.Assert(errors.Is(err, os.ErrNotExist)).IsTrue()
 | 
			
		||||
 | 
			
		||||
			g.Assert(fs.diskUsed).Equal(int64(0))
 | 
			
		||||
			g.Assert(atomic.LoadInt64(&fs.diskUsed)).Equal(int64(0))
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
		g.It("deletes all items inside a directory if the directory is deleted", func() {
 | 
			
		||||
| 
						 | 
				
			
			@ -762,11 +765,11 @@ func TestFilesystem_Delete(t *testing.T) {
 | 
			
		|||
				g.Assert(err).IsNil()
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			fs.diskUsed = int64(utf8.RuneCountInString("test content") * 3)
 | 
			
		||||
			atomic.StoreInt64(&fs.diskUsed, int64(utf8.RuneCountInString("test content")*3))
 | 
			
		||||
 | 
			
		||||
			err = fs.Delete("foo")
 | 
			
		||||
			g.Assert(err).IsNil()
 | 
			
		||||
			g.Assert(fs.diskUsed).Equal(int64(0))
 | 
			
		||||
			g.Assert(atomic.LoadInt64(&fs.diskUsed)).Equal(int64(0))
 | 
			
		||||
 | 
			
		||||
			for _, s := range sources {
 | 
			
		||||
				_, err = rfs.StatServerFile(s)
 | 
			
		||||
| 
						 | 
				
			
			@ -777,8 +780,9 @@ func TestFilesystem_Delete(t *testing.T) {
 | 
			
		|||
 | 
			
		||||
		g.AfterEach(func() {
 | 
			
		||||
			rfs.reset()
 | 
			
		||||
			fs.diskUsed = 0
 | 
			
		||||
			fs.diskLimit = 0
 | 
			
		||||
 | 
			
		||||
			atomic.StoreInt64(&fs.diskUsed, 0)
 | 
			
		||||
			atomic.StoreInt64(&fs.diskLimit, 0)
 | 
			
		||||
		})
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,13 +0,0 @@
 | 
			
		|||
package filesystem
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"syscall"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Returns the time that the file/folder was created.
 | 
			
		||||
func (s *Stat) CTime() time.Time {
 | 
			
		||||
	st := s.Info.Sys().(*syscall.Stat_t)
 | 
			
		||||
 | 
			
		||||
	return time.Unix(int64(st.Ctim.Sec), int64(st.Ctim.Nsec))
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -9,5 +9,6 @@ import (
 | 
			
		|||
func (s *Stat) CTime() time.Time {
 | 
			
		||||
	st := s.Info.Sys().(*syscall.Stat_t)
 | 
			
		||||
 | 
			
		||||
	return time.Unix(st.Ctim.Sec, st.Ctim.Nsec)
 | 
			
		||||
	// Do not remove these "redundant" type-casts, they are required for 32-bit builds to work.
 | 
			
		||||
	return time.Unix(int64(st.Ctim.Sec), int64(st.Ctim.Nsec))
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user